class Spinach::Features::Signup < Spinach::FeatureSteps
attr_accessor :valid_attributes
before do
valid_attributes = Fabricate.attributes_for(:identity)
#@valid_attributes = Fabricate :identity
end
step 'I am a visitor' do
true
visit root_path
end
step 'I am on the landing page' do
current_path.must_equal root_path
end
step 'I follow signup link' do
click_link('signup_link')
end
step 'I fill name with my name' do
fill_in 'name', with: valid_attributes.name
end
step 'I fill email with my email' do
fill_in "email", with: valid_attributes.email
end
end
i use spinach gem for creating feature steps. above code id my feature steps. i also use minitest for testing framework. i use fabricator gem for creating random datas.
require "ffaker"
Fabricator(:identity) do
name {Faker::Name.name}
email {Faker::Internet.email}
password_digest "ChtUIGTiBvrm6v6R4PX6sO3netSuN3eW0AbFmXblXvgKM5Z8sFUKy"
end
this is my fabricator class for identity model. when i run signup feature, i see an error:
undefined method `name' for nil:NilClass
i think that it is about Fabricate.Attributes_for. if i use Fabricate :identity, it doesn't give error.
i couldn't solve this. Any ideas? Thanks in advance.