*一些视频: 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
endMake 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:installDouble-check that everything was installed by running the tasks:
rake spec
rake cucumber因为features和specs还没写,配置正确的话, 以上两条命令应该是正确运行并且提示没有test运行。 RSpec根据版本不同,也有可能提示找不到 '_spec.rb' 文件。
本文介绍了如何在Rails应用中设置RSpec与Cucumber的集成,包括安装所需gem、配置Gemfile以及运行Cucumber和RSpec的基本步骤。确保正确安装gem并配置环境以进行高效的测试和自动化测试。
913

被折叠的 条评论
为什么被折叠?



