我照着 Rails Tutorial 做到了第九章,这一段测试代码通不过,
describe "User pages" do
.
.
.
describe "edit" do
let(:user) { FactoryGirl.create(:user) }
before { visit edit_user_path(user) }
describe "page" do
it { should have_content("Update your profile") }
it { should have_title("Edit user") }
it { should have_link('change', href: 'http://gravatar.com/emails') }
end
describe "with invalid information" do
before { click_button "Save changes" }
it { should have_content('error') }
end
end
end
应该有的 content, title, link 都说没有,还有找不到 "Save changes" 按钮,但是我从浏览器中打开编辑页面发现这些元素都存在,这是怎么回事呢?