Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_list without the count should give a proper error message #889

Closed
tejasbubane opened this issue Apr 1, 2016 · 1 comment
Closed

Comments

@tejasbubane
Copy link
Contributor

Sometimes I forget to pass in the count attribute for create_list (eg. when I change create to create_list and I forget to add the count):

create_list(:user, profile: profile)

The error in this case is:

Failure/Error: create_list(:user, profile: profile)

     NoMethodError:
       undefined method `times' for #<Hash:0x007fda3bd50738>
# /Users/tejas/.rvm/gems/ruby-2.3.0@oudux/gems/factory_girl-4.5.0/lib/factory_girl/strategy_syntax_method_registrar.rb:28:in `block in define_list_strategy_method'

I feel this error should be a little more elaborate saying something like the create_list method expects a count.

FactoryGirl version in use here: 4.5.0

@Charizard
Copy link

Agreed 👍

tejasbubane added a commit to tejasbubane/factory_girl that referenced this issue May 19, 2016
Closes thoughtbot#889

`create_list` was failing abruptly if the second argument was not
count. Give a descriptive error message for this case.
tejasbubane added a commit to tejasbubane/factory_girl that referenced this issue Aug 26, 2016
Closes thoughtbot#889

`create_list` was failing abruptly if the second argument was not
count. Give a descriptive error message for this case.
drapergeek pushed a commit that referenced this issue Aug 26, 2016
Closes #889

`create_list` was failing abruptly if the second argument was not
count. Give a descriptive error message for this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants