[rspec-users] class variables different between spec and runtime?
dchelimsky at gmail.com
Tue Dec 22 10:24:33 EST 2009
On Tue, Dec 22, 2009 at 9:22 AM, David Chelimsky <dchelimsky at gmail.com>wrote:
> On Tue, Dec 22, 2009 at 9:14 AM, Peter Fitzgibbons <
> peter.fitzgibbons at gmail.com> wrote:
>> Hello Folks,
>> This gist http://gist.github.com/261791 has an example user.rb,
>> At runtime, this snippet fails
>> u = User.find(123)
>> The error occurred while evaluating nil.select):
>> app/models/user.rb:6:in `moderator_fields'
>> app/models/user.rb:118:in `update_with_profile'
>> The spec passes all-green.
>> Could you tell me how this might be ?
> The user in the spec comes from new_with_profile(), which sets instance
> variables on the User class.
> The user in the console comes from find(), and those ivars are not yet set.
Also - @params in the User class (in the class methods) is not the same
@params in the User instances (in update_with_profile).
>> Peter Fitzgibbons
>> (847) 687-7646
>> Email: peter.fitzgibbons at gmail.com
>> IM GTalk: peter.fitzgibbons
>> IM AOL: peter.fitzgibbons at gmail.com
>> rspec-users mailing list
>> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users