Rspec и capybara, разница между методами посещения и получения, в отношении объекта current_path
Я, возможно, путаю методы стойки и капибары здесь
let!(:admin){FactoryGirl.create(:admin)}
# test passes
describe "visiting #edit page" do
before { visit edit_user_path(admin) }
specify { current_path.should eq(edit_user_path(admin)) }
end
# test fails
describe "getting #edit page" do
before { get edit_user_path(admin) }
specify { current_path.should eq(edit_user_path(admin)) }
end
Второй тест не проходит с:
Failure/Error: specify { current_path.should eq(edit_user_path(admin)) }
expected: "/users/51/edit"
got: "/users/51"
(compared using ==)
before(:each)
блок, устанавливает current_path в/users/51
так, похоже, так и остается при использованииget
.
Я просто хочу проверить здесь:
do visit and current_path come from capybara, whereas get comes from rack? does the current_path object necessarily require you to use the visit method, in order to keep it updated?