我正在尝试测试当前路径,并检查它是否打开post_path(post)
。我很确定测试应该通过。但我越来越got: #<Capybara::Session> (using ==)
。我真的不明白这是什么。
这是测试代码
require 'spec_helper'
describe PostsController do
subject { page }
let(:first_user_is_admin) { FactoryGirl.create(:user) }
describe "Not signed in user cannot see any kind of edit view for a post:" do
describe "Post is anonymous without user_id" do
let(:post) {FactoryGirl.create(:anonymous_post)}
before do
visit edit_post_path(post)
end
it { should == post_path(post) }
end
end
end
这是测试结果。
1) PostsController Not signed in user cannot see any kind of edit view for a post: Post is anonymous without user_id
Failure/Error: it { should == post_path(post) }
expected: "/posts/1"
got: #<Capybara::Session> (using ==)
Diff:
@@ -1,2 +1,2 @@
-"/posts/1"
+#<Capybara::Session>