私はおそらくここでラックとカピバラの方法を混乱させています
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
2番目のテストは次の場合に失敗します。
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
。
ここで確認したいだけです:
- visitとcurrent_pathはカピバラから来ていますが、 getはラックから来ていますか?
- current_pathオブジェクトは、更新を維持するために、必ずvisitメソッドを使用する必要がありますか?