features/rails3.feature in cucumber-rails-0.3.2 vs features/rails3.feature in cucumber-rails-0.4.0.beta.1

- old
+ new

@@ -1,70 +1,32 @@ -@announce-cmd -@announce @puts +@announce Feature: Rails 3 In order to take over the world Cucumber-Rails should work on major versions - of Rails2 and Ruby, with Capybara, Spork and DatabaseCleaner + of Rails 3 and Ruby, with Capybara, Spork and DatabaseCleaner Scenario: Install Cucumber-Rails - Given I am using rvm "ruby-1.8.7-p249" - And I am using rvm gemset "cucumber-rails-3.0.0.beta" with Gemfile: - """ - source :gemcutter - gem 'rails', '3.0.0.beta' - gem 'sqlite3-ruby', '1.2.5' - gem 'capybara', '0.3.8' - """ - When I successfully run "rails rails-3-app" - Then it should pass with: - """ - README - """ - And I cd to "rails-3-app" - And I symlink "../../.." to "vendor/plugins/cucumber-rails" - When I successfully run "rails generate cucumber:install --capybara" + Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support Then the following files should exist: | config/cucumber.yml | | script/cucumber | | features/step_definitions/web_steps.rb | | features/support/env.rb | | features/support/paths.rb | | lib/tasks/cucumber.rake | - And the file "features/support/env.rb" should contain "require 'cucumber/rails/world'" - And the file "features/support/env.rb" should contain "require 'capybara/rails'" + And the file "features/support/env.rb" should contain "require 'cucumber/rails'" - Scenario Outline: Run Cucumber - Given I am using rvm "<ruby_version>" - And I am using rvm gemset "cucumber-rails-3.0.0.beta-gemset-<gemset>" with Gemfile: - """ - source :gemcutter - gem 'rails', '3.0.0.beta' - gem 'sqlite3-ruby', '1.2.5' - gem 'capybara', '0.3.8' - gem 'gherkin', '1.0.30' - gem 'term-ansicolor', '1.0.4' - gem 'diff-lcs', '1.1.2' - gem 'rspec-rails', '<rspec_version>' - """ - And I successfully run "rails rails-3-app" - And I cd to "rails-3-app" - And I symlink "../../.." to "vendor/plugins/cucumber-rails" - And I append to "Gemfile" with: - """ - gem 'capybara', '0.3.8' - gem 'cucumber', :path => '../../../../cucumber' - - """ - And I successfully run "rails generate cucumber:install --capybara" + Scenario: Inspect query string + Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support And I successfully run "rails generate cucumber:feature post title:string body:text published:boolean" And I successfully run "rails generate scaffold post title:string body:text published:boolean" And I successfully run "rails generate scaffold cukes name:string" - And I write to "app/controllers/cukes_controller.rb" with: + And I overwrite "app/controllers/cukes_controller.rb" with: """ class CukesController < ApplicationController def index - redirect_to cuke_path(10, :overwrite_params => {:name => 'cucumber', :what => 'vegetable'}) + redirect_to cuke_path(10, {:name => 'cucumber', :what => 'vegetable'}) end def show render :text => "Cuke #{params[:id]}" end @@ -74,24 +36,88 @@ """ Feature: Tests Scenario: Tests When I go to the cukes page Then I should have the following query string: - |name|cucumber| - |what|vegetable| - |controller|cukes| - |action|index| + | name | cucumber | + | what | vegetable | And I should see "Cuke 10" """ - And I successfully run "bundle lock" And I successfully run "rake db:migrate" And I successfully run "rake cucumber" Then it should pass with: """ 3 scenarios (3 passed) 14 steps (14 passed) """ - - Examples: - | ruby_version | rspec_version | gemset | - | ruby-1.8.7-p249 | 1.3.2 | 1 | - | ruby-1.9.1-p378 | 2.0.0.beta.10 | 2 | + + Scenario: Allow rescue + Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support + And I write to "app/controllers/posts_controller.rb" with: + """ + class PostsController < ApplicationController + def index + raise "There is an error in index" + end + end + """ + And I write to "config/routes.rb" with: + """ + Rails3App::Application.routes.draw do + resources :posts + end + """ + And I write to "features/posts.feature" with: + """ + Feature: posts + @allow-rescue + Scenario: See them + When I do it + """ + And I write to "features/step_definitions/posts_steps.rb" with: + """ + When /^I do it$/ do + visit '/posts' + puts page.body + end + """ + And I run "rake cucumber" + Then it should pass with: + """ + 1 scenario (1 passed) + 1 step (1 passed) + """ + + Scenario: Don't allow rescue + Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support + And I write to "app/controllers/posts_controller.rb" with: + """ + class PostsController < ApplicationController + def index + raise "There is an error in index" + end + end + """ + And I write to "config/routes.rb" with: + """ + Rails3App::Application.routes.draw do + resources :posts + end + """ + And I write to "features/posts.feature" with: + """ + Feature: posts + Scenario: See them + When I do it + """ + And I write to "features/step_definitions/posts_steps.rb" with: + """ + When /^I do it$/ do + visit '/posts' + end + """ + And I run "rake cucumber" + Then it should fail with: + """ + 1 scenario (1 failed) + 1 step (1 failed) + """