#27 ✓resolved
Roland

undefined method `klass' for nil:NilClass (NoMethodError)

Reported by Roland | 2010-08-11 11:11:40 UTC

Hi,

(This error did not occur on pickle 0.3.0 and rails 2.3.5.)

Given pickle 0.3.4 and rails 3.0.0.rc

When I am using pickle_steps.rb#34:

find exactly n models

Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
find_models(plural_factory.singularize, fields).size.should == count.to_i end

And I use a model name (for the plural_factory) which has a space (example: blog entries, article comments, ...)

Then I get the error: undefined method klass' for nil:NilClass (NoMethodError)

Debugging down the stack tells me that in pickle-0.3.4/lib/pickle/session.rb#63

model_class = pickle_config.factories[factory].klass

throws that error.

eval pickle_config.factories.keys.include?(model_name_with_space) --> false
eval pickle_config.factories.keys.include?(model_name_without_space) --> true
eval factory --> model_name_with_space, hence pickle_config.factories[factory]==nil

Please check it.

Thanks in advance.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Assign tickets to Ian White, so I get notified

People watching this ticket

Referenced by

Pages