开发者

How do I setup and utilize Shoulda, Factory_Girl, and Cucumber in a Rails 3 application?

I'm able to get my Gemfile how I like it:

# Gemfile
source "http:开发者_如何学运维//gemcutter.org"
gem "rails", :git => "git://github.com/rails/rails.git"
git "git://github.com/rails/arel.git"
git "git://github.com/rails/rack.git"
gem "sqlite3-ruby"

group :test do
  gem "shoulda",      :git => "git://github.com/thoughtbot/shoulda.git",      :branch => "rails3"
  gem "factory_girl", :git => "git://github.com/thoughtbot/factory_girl.git", :branch => "rails3"
  gem "capybara"
  gem "database_cleaner"
  gem "cucumber-rails"
end

Then, of course, bundle install

From here, would someone be able to walk me through the process of generating a Cucumber scenario, creating a Factory, and then using the factory with Shoulda declarations inside a unit test? I've seen bits and pieces of all of these things scattered over blogs but due to the speed at which Rails3 is moving I am having a hard time finding a definitive source and my own forays have been unsuccessful and frustrating. Rather than providing my error messages I was hoping someone could just walk me through a clean-slate approach to show how it all works. This would probably be a good addition to http://guides.rails.info Testing section.

Perhaps the resource could be: bundle exec rails generate scaffold task description:string notes:text project_id:integer due:date complete:boolean only using Cucumber of course.

Thank you so much on behalf of all of us still learning and trying to follow tdd/bdd!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜