*一些视频: http://vimeo.com/34754907
1. RSpec
1. RSpec
2. Unit test
3. DSL:
Domain-specific language, examplesso far, migrations, regexes, SQL
4. "should_receive" to mock up a method.
5. 一篇关于RSpec的中文简单介绍: http://ruby-china.org/topics/2848
6. 代码覆盖分析工具SimpleCov: https://github.com/colszowka/simplecov
如何设置Cucumber + RSpec:
Make sure your Gemfile contains the above codes, as well as the line
运行
If necessary, set up the Cucumber directories (under
Double-check that everything was installed by running the tasks:
5. 一篇关于RSpec的中文简单介绍: http://ruby-china.org/topics/2848
6. 代码覆盖分析工具SimpleCov: https://github.com/colszowka/simplecov
如何设置Cucumber + RSpec:
group :test, :development do
gem 'cucumber-rails'
gem 'cucumber-rails-training-wheels' # some pre-fabbed step definitions
gem 'database_cleaner' # to clear Cucumber's test database between runs
gem 'capybara' # lets Cucumber pretend to be a web browser
gem 'launchy' # a useful debugging aid for user stories
end
Make sure your Gemfile contains the above codes, as well as the line
gem 'rspec-rails'within the
group :test, :development
block.
运行
bundle install --without production
来保证gem都安装了。
If necessary, set up the Cucumber directories (under
features/
) and the RSpec directories (under
spec/
), allowing overwrite of any existing files, by running the commands:
rails generate cucumber:install capybara
rails generate cucumber_rails_training_wheels:install
rails generate rspec:install
Double-check that everything was installed by running the tasks:
rake spec
rake cucumber因为features和specs还没写,配置正确的话, 以上两条命令应该是正确运行并且提示没有test运行。 RSpec根据版本不同,也有可能提示找不到 '_spec.rb' 文件。