Tôi nhận được một trang trắng tinh như phản ứng khi chạy thử nghiệm RSpec sau:Bắt trang trống khi chạy thử nghiệm RSpec cho get 'mới'
require 'spec_helper'
describe FriendshipsController do
include Devise::TestHelpers
render_views
before(:each) do
@user = User.create!(:email => "[email protected]", :password => "mustermann", :password_confirmation => "mustermann")
@friend = User.create!(:email => "[email protected]", :password => "password", :password_confirmation => "password")
sign_in @user
end
describe "GET 'new'" do
it "should be successful" do
get 'new', :user_id => @user.id
response.should be_success
end
it "should show all registered users on Friendslend, except the logged in user" do
get 'new', :user_id => @user.id
page.should have_select("Add new friend")
page.should have_content("div.users")
page.should have_selector("div.users li", :count => 1)
end
it "should not contain the logged in user" do
get 'new', :user_id => @user.id
response.should_not have_content(@user.email)
end
end
end
tôi chỉ nhận được một trang trống khi chạy thử nghiệm RSpec. Với trang trống, tôi có nghĩa là không có nội dung HTML nào khác ngoài khai báo DOCTYPE.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
Điều thú vị là, kiểm tra RSpec cho bài 'tạo' hoạt động tốt. Bất kỳ gợi ý nào?
Tôi đang sử dụng Rails 3.2 với spec-ray, dưa chuột và capybara (thay vì webrat).
Tôi tò mò, bạn đã bao giờ tìm thấy giải pháp cho vấn đề này chưa? – voxobscuro
cũng tò mò về một giải pháp cho điều này .. – jay
Rất tiếc, tôi chưa có giải pháp ... –