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
-

Roland 2010-08-11 11:21:39 UTC
my quick solution for this is to use
plural_factory.singularize.parameterize('_')
instead of
plural_factory.singularize
-

-

Ian White 2010-08-12 12:17:48 UTC
- State changed from new to resolved
(from [24ef11dcaa25fa8002ea5fa67ceb0d114b31dcfb]) find_models now works with a factory name with spaces in it [#27 state:resolved] http://github.com/ianwhite/pickle/commit/24ef11dcaa25fa8002ea5fa67c...
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.
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
Referenced by
-
27
undefined method `klass' for nil:NilClass (NoMethodError)
(from [24ef11dcaa25fa8002ea5fa67ceb0d114b31dcfb])
find_mo...