Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

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

#27

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.

Reported by Roland · August 11th, 2010 @ 11:11 AM

State: resolved
Milestone: none
Assigned to: Ian White Ian White

Activity

  1. Roland
    Roland

    my quick solution for this is to use

    plural_factory.singularize.parameterize('_')

    instead of

    plural_factory.singularize

    August 11th, 2010 @ 11:21 AM

  2. Ian White
    Ian White

    Thanks for the bug report, looking into it.

    Cheers,
    Ian

    August 12th, 2010 @ 10:29 AM

  3. Ian White

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.