Alors, comment nous résolvons l'erreur dans la fonction initialize, Quelle chose doit être fait pour éliminer cette erreurArgumentError: nombre incorrect d'arguments (1 pour 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
Lors du test du modèle modèle user_spec.rb, l'erreur est générée:
Veuillez ajouter 'u.password_confirmation" hellohello "' dans 'Factories/user.rb'. –
Oui j'ai ajouté u.password_confirmation "hellohello" mais a toujours le même problème. –
Votre code doit figurer dans la question en tant que * texte *, et non en tant que captures d'écran. – meagar