Login

    Register

Managed Hosting

PROJECT CATEGORIES

 

cfSpec
Project Home Blog Wiki Known Issues Screenshots Contact Project

cfSpec Issue: $( ) doesn't invoke methods with named argument correctly

Name: $( ) doesn't invoke methods with named argument correctly
ID: 1
Project: cfSpec
Type: Bug
Area: Code
Severity: High
Status: Fixed
Related URL:
Creator: Henry Ho
Created: 01/29/09 2:44 PM
Updated: 02/22/09 10:30 PM
Description: Assume this func in UserService component.

<cffunction name="getUsers returnType="array">
<cfargument name="userId" type="numeric">
<cfargument name="email" type="string">

<cfreturn []>
</cffunction>


To search by email by named argument:

userService.getUsers(email="abc@def.com");

However, when I make the same call in cfspec, the string "abc@def.com" is passed to the first argument (userId), instead of email (2nd argument).

<it>
$(userService)
.getUsers(email="abc@def.com")
.shouldNotThrow()
</it>

Running the above test will complain the USERID passed in, "abc@def.com", is not numeric.
History: Created by henryho (Henry Ho) : 01/29/09 2:44 PM

Comment by henryho (Henry Ho) : 01/29/09 4:41 PM
Here is my attempt to fix this bug:

update lib/Expectation.cfc line:95 to:

result=evaulate("$target.#missingMethodName#(argumentCollection=arguments.missingMethodArguments)");


Also, the for-loop in line 90 does not seem necessary. I comment that out. Even if it is useful, maybe use Duplicate() instead?

After the change, the cfspec stays at 19 failures. http://www.adelphus.com/2009%2F1%2F11%2Fwhats-new-in-cfspec-v0-1-1

Updated by adelphus (Ron Hopper) : 02/22/09 10:30 PM
Fixed in v0.2.0

To add a comment to this bug, please login using the link above.