我对红宝石路轨很陌生。我刚刚完成了这个教程,当我把我的罪过税换成我收到的错误时,我正试图从头开始制作我自己的ruby网站:
我所犯的错误是:
1) Pages Home page
Failure/Error: it { should have_content('Home') }
NoMethodError:
undefined method `has_content?' for "Home page":String
# ./spec/requests/pages_spec.rb:7:in `block (3 levels) in <top (required)>'2)页面主页失败/错误:它{应该have_title(' Home ') } NoMethodError:未定义的方法has_title?' for "Home page":String # ./spec/requests/pages_spec.rb:8:in块(3个级别)
这是我的rspec文件
require 'spec_helper'
describe "Pages" do
describe "Home page" do
before { visit root_path }
it { should have_content('Home') }
it { should have_title('Home') }
end
end我不知道怎么回事,我忘了把什么东西包括在我的宝石档案里?如果你想要更多的信息评论,我会把它包括在这里
发布于 2014-03-12 04:28:01
试一试
it 'has home title' do
expect(page).to have_title('Home')
end
it 'has home content' do
expect(page).to have_content('Home')
end或
subject { page }
it { should have_title('Home') }
it { should have_content('Home') }https://stackoverflow.com/questions/22341738
复制相似问题