Ruby on Rails
上一篇 /
下一篇 2016-06-20 21:44:54
/ 个人分类:经验总结
1.
1) StaticPages Home Page should have the content 'Sample App'
Failure/Error:visit '/static_pages/home'
NoMethodError:
undefined method `visit' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fe047118c88>
workaround:
add this config in spec_helper.rb [config.include Capybara::DSL]
2. page.should have_selector('title', :text => "Ruby on Rails Tutorial Sample App | Home") couldn't work
workaround
Capybara.string(page.body).has_selector?('title', text:"Ruby on Rails Tutorial Sample App | Home")
3. when do rspec test, if the error "couldn't find the table 'users'" throwed, and you find everything is ok, users table is worked. you can try the following command.
rake db:test:prepare
4. concern的用法
https://ruby-china.org/topics/19812 参考这篇文章,比较详细
收藏
举报
TAG: