-1
那么,我们如何解决初始化函数的错误,这件事需要做消除这种误差引发ArgumentError:错误的参数数目(1 0)
Here is the Factories/user.rb
FactoryGirl.define do
factory :user do |u|
u.first_name Faker::Name.first_name
u.last_name Faker::Name.last_name
u.email Faker::Internet.email
u.username Faker::Name.name
u.title Faker::Name.title
u.password "hellohello"
u.password_confirmation "hellohello"
end
end
Here is the mode spec model/user_spec.rb
require 'rails_helper'
RSpec.describe User, :type => :model do
user = ''
describe "create" do
user = FactoryGirl.create(:user)
end
#describe "validations"
describe "Count all the user" do
it "should have one item created before being created" do
#binding.pry
expect(User.all.count).to eq(1)
end
end
end
请将'u.password_confirmation“hellohello''添加到'Factories/user.rb'中。 –
是的,我已经添加了u.password_confirmation“hellohello”,但仍然有相同的问题。 –
您的代码需要以* text *的形式出现,而不是屏幕截图。 – meagar