Failure/Error: let(:user) { FactoryGirl.create :user }
NoMethodError:
undefined method `projects_count' for #<FactoryGirl::SyntaxRunner:0x007fb36a4a78b8>
Last active
August 29, 2015 14:08
-
-
Save wasabhi/9409cd164e672a96f2c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read about factories at https://github.com/thoughtbot/factory_girl | |
FactoryGirl.define do | |
factory :account do | |
name "MyString" | |
factory :account_with_projects do | |
transient do | |
projects_count 2 | |
end | |
after(:create) do |account, evaluator| | |
create_list(:project, evaluator.projects_count, account: account) | |
end | |
end | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryGirl.define do | |
factory :user do | |
name 'MyString' | |
email 'email@email.com' | |
password 'password' | |
after(:build) do |user| | |
user.password_confirmation = user.password | |
user.confirm! | |
end | |
account_with_projects | |
end | |
end |
matt-wratt
commented
Oct 30, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment