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

posted @ 2012-11-08 00:17  scige  阅读(256)  评论(0编辑  收藏  举报