Я новичок в Cucumber и совершенно не понимаю, почему этот интеграционный тест не пройден. У меня есть следующие сценарии:
Scenario: User changes profile
Given I have an account
When I change my profile
Then my profile should be saved
Scenario: User changes login
Given I have an account
When I change my login information
Then my account should be changed
И эти определения шагов:
Given /^I have an account$/ do
@user = Factory.create(:user)
visit login_path
fill_in "Email", :with => @user.email
fill_in "Password", :with => 'secret'
click_button "Sign in"
end
When /^I change my profile$/ do
visit edit_user_profile_path(@user)
fill_in "First name", :with => "John"
fill_in "Last name", :with => "Doe"
click_button "Update Profile"
end
Then /^my profile should be saved$/ do
@user.profile.first_name.should == "John"
@user.profile.last_name.should == "Doe"
end
When /^I change my login information$/ do
visit edit_user_path(@user)
fill_in "Email", :with => "foo@example.com"
click_button "Update Login Information"
end
Then /^my account should be changed$/ do
@user.email.should == "foo@example.com"
end
И мне не удается выполнить условие «Тогда» в обоих сценариях с этим сообщением:
# Scenario 1
expected: "John"
got: "Test1" (using ==) (RSpec::Expectations::ExpectationNotMetError)
# Scenario 1
expected: "foo@example.com"
got: "test2@example.com" (using ==) (RSpec::Expectations::ExpectationNotMetError)
Таким образом, в обоих случаях заводская информация все еще присутствует после отправки формы для обновления имени пользователя или профиля. Тем не менее, если я протестирую это в реальном браузере, он работает отлично. Итак, почему этот тест не проходит ???
Спасибо за помощь!