【发布时间】:2016-02-23 02:29:12
【问题描述】:
我已安装 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>
【问题讨论】:
-
试试
FactoryGirl.create
标签: rspec factory-bot rspec-rails