我已经安装了FactoryBot,并尝试在RSpec中使用它。
scenario 'User signs in' do
create :user, email: 'test@example.com', password: 'testpassword'
visit '/users/sign_in'
fill_in 'Email', with: 'test@example.com'
fill_in 'Password', with: 'testpassword'
end我得到了下面的错误。
Failure/Error: create :user, email: 'test@example.com', password: 'testpassword'
NoMethodError:
undefined method `create' for #<RSpec::ExampleGroups::UserSignIn:0x007fe6324816b8>发布于 2016-10-02 17:19:25
在我的例子中,我错过了rails_helper.rb中的config.include FactoryGirl::Syntax::Methods
https://stackoverflow.com/questions/33829440
复制相似问题