rspec使用

命令

$ rails generate rspec:install

$ bundle exec rake db:test:prepare

$ rails generate integration_test static_pages

$ bundle exec rspec spec/requests/static_pages_spec.rb

$ rake spec

语法

describe

pending

before

subject

it

its

let

visit

page.should have_content

page.should have_selector

重要

database_cleaner在每个it的block完成后就clean

问题

http://procbits.com/2011/08/18/using-mongoid-with-rspec/

http://blog.revathskumar.com/2012/07/rails3-solving-issue-undefined-method.html

原文地址:https://www.cnblogs.com/scige/p/2759722.html