0
你好,我有一個Rspec +水豚的問題。我想測試我的ajax評論可以發佈。我的錯誤是因爲帖子沒有創建。使用Rspec進行Ajax評論
Failure/Error: page.should have_content('Could')
當我輸出@post我看到
#<Post id: 1, title: "Deploying through ssh", body: "This is post about ssh", slug: deploying-through-ssh, published: nil, published_at: nil, created_at: "2013-02-05 17:37:39", updated_at: "2013-02-05 17:37:39", user_id: nil, meta_desc: nil>
describe "Sending Comments" do
before(:each) do
@post = FactoryGirl.create(:post)
end
it "should allow user to post new comment", :js => true do
visit post_path(@post)
page.should have_content('Could')
fill_in 'comment[name]', :with => "name"
fill_in 'comment_email', :with => "[email protected]"
fill_in 'comment_content', :with => "content"
end
end