diff --git a/Appraisals b/Appraisals index 1abb4d57..46016028 100644 --- a/Appraisals +++ b/Appraisals @@ -51,3 +51,18 @@ appraise "capybara_1_1" do gem 'bson_ext' gem 'mongoid' end + +appraise "rails_4_0" do + gem "rails", "~> 4.0.0.beta1" + gem "railties", "~> 4.0.0.beta1" + gem "capybara", "~> 2.0.2" + gem 'turn' + gem 'rspec-rails' + gem 'sass-rails', "~> 4.0.0.beta1" + gem 'coffee-rails', "~> 4.0.0.beta1" + gem 'uglifier' + gem 'jquery-rails' + gem 'sqlite3' + gem 'bson_ext' + gem 'mongoid' +end diff --git a/Gemfile b/Gemfile index d3e88b5f..8fa74008 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source "https://rubygems.org" # Test dependencies for Rails in the default test task, as test-generated # apps do not run bundler for speed reasons. Kept here so they can be # excluded from Appraisal-generated gemfiles. -gem 'rails', '~> 3.2.12' +gem 'rails' gem 'turn' gem 'rspec-rails' gem 'sass-rails' diff --git a/cucumber-rails.gemspec b/cucumber-rails.gemspec index 1f2e5f2d..28459a70 100644 --- a/cucumber-rails.gemspec +++ b/cucumber-rails.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('cucumber', '>= 1.2.0') s.add_runtime_dependency('nokogiri', '>= 1.5.0') s.add_runtime_dependency('capybara', '>= 1.1.2') - s.add_runtime_dependency('rails', '~> 3.0') + s.add_runtime_dependency('rails', '>= 3.0.0') # Main development dependencies s.add_development_dependency('rake', '>= 0.9.2.2') @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_development_dependency('rspec', '~> 2.10.0') s.add_development_dependency('ammeter', '>= 0.2.5') s.add_development_dependency('factory_girl', '>= 3.2.0') - s.add_development_dependency('database_cleaner', '>= 0.7.2') + s.add_development_dependency('database_cleaner', '>= 1.0.0.RC1') s.add_development_dependency('appraisal', '~> 0.5.1') # For Documentation: diff --git a/features/allow_rescue.feature b/features/allow_rescue.feature index f30e2e87..80b3c9fa 100644 --- a/features/allow_rescue.feature +++ b/features/allow_rescue.feature @@ -1,7 +1,7 @@ Feature: Allow Cucumber to rescue exceptions Background: A controller that raises an exception - Given I have created a new Rails 3 app "rails-3-app" and installed cucumber-rails + Given I have created a new Rails app "rails-app" and installed cucumber-rails And I write to "app/controllers/posts_controller.rb" with: """ class PostsController < ApplicationController @@ -12,11 +12,11 @@ Feature: Allow Cucumber to rescue exceptions """ And I write to "config/routes.rb" with: """ - Rails3App::Application.routes.draw do + RailsApp::Application.routes.draw do resources :posts end """ - + Scenario: Allow rescue Given I write to "features/posts.feature" with: """ diff --git a/features/capybara_javascript_drivers.feature b/features/capybara_javascript_drivers.feature index 60cc7d62..1a75076c 100644 --- a/features/capybara_javascript_drivers.feature +++ b/features/capybara_javascript_drivers.feature @@ -2,7 +2,7 @@ Feature: Capybara Javascript Drivers Background: A simple calendar app - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails And I successfully run `bundle exec rails g scaffold appointment name:string when:datetime` And I write to "features/step_definitions/date_time_steps.rb" with: """ @@ -18,7 +18,7 @@ Feature: Capybara Javascript Drivers select_datetime(datetime, :from => selector) end """ - + Scenario: Use a particular driver Given I write to "features/create_appointment.feature" with: """ diff --git a/features/choose_javascript_database_strategy.feature b/features/choose_javascript_database_strategy.feature index 81706782..be3890d4 100644 --- a/features/choose_javascript_database_strategy.feature +++ b/features/choose_javascript_database_strategy.feature @@ -24,9 +24,9 @@ Feature: Choose javascript database strategy has been reported by some Oracle users. Background: - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails And I have a "Widget" ActiveRecord model object - + Scenario: Set the strategy to truncation and run a javascript scenario. Given I append to "features/env.rb" with: """ @@ -110,6 +110,7 @@ Feature: Choose javascript database strategy 2 scenarios (2 passed) 5 steps (5 passed) """ + Scenario: Set the strategy to truncation with an except option and run a javascript scenario. Given I append to "features/env.rb" with: """ diff --git a/features/database_cleaner.feature b/features/database_cleaner.feature index 3099f94a..f9654e4d 100644 --- a/features/database_cleaner.feature +++ b/features/database_cleaner.feature @@ -1,7 +1,7 @@ Feature: DatabaseCleaner Scenario: Create records in background - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails And I write to "features/widgets.feature" with: """ Feature: Create widgets diff --git a/features/disable_automatic_database_cleaning.feature b/features/disable_automatic_database_cleaning.feature index 72f4bbcd..90013689 100644 --- a/features/disable_automatic_database_cleaning.feature +++ b/features/disable_automatic_database_cleaning.feature @@ -11,7 +11,7 @@ Feature: Disable automatic database cleaning control the invocation of database_cleaner explicitly. Scenario: Disabling automatic cleaning - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails And I append to "features/env.rb" with: """ Cucumber::Rails::Database.autorun_database_cleaner = false diff --git a/features/emulate_javascript.feature b/features/emulate_javascript.feature index bd60e298..622b6ce2 100644 --- a/features/emulate_javascript.feature +++ b/features/emulate_javascript.feature @@ -1,7 +1,7 @@ Feature: Emulate Javascript Scenario: See a widget - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails And I successfully run `rails generate scaffold widget name:string` And I write to "features/f.feature" with: """ @@ -35,7 +35,7 @@ Feature: Emulate Javascript """ Scenario: Pass on the CSRF token - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails And I successfully run `rails generate scaffold widget name:string` And I successfully run `sed -i -e 's/forgery_protection *= false/forgery_protection = true/' config/environments/test.rb` And I successfully run `rails generate controller session establish` diff --git a/features/fixing_bundler_pre.feature b/features/fixing_bundler_pre.feature index 4b1f7eb1..afbad545 100644 --- a/features/fixing_bundler_pre.feature +++ b/features/fixing_bundler_pre.feature @@ -5,8 +5,25 @@ Feature: Fixing Bundler Pre @bundler-pre Scenario: Install Cucumber-Rails with bundler prerelease - Given I have created a new Rails 3 app and installed cucumber-rails, accidentally outside of the test group in my Gemfile + Given I have created a new Rails app and installed cucumber-rails, accidentally outside of the test group in my Gemfile And I successfully run `rake db:migrate` + And I write to "app/controllers/home_controller.rb" with: + """ + class HomeController < ActionController::Base + def index + end + end + """ + And I write to "config/routes.rb" with: + """ + TestApp::Application.routes.draw do + root to: 'home#index' + end + """ + And I write to "app/views/home/index.html.erb" with: + """ + h1 Test App + """ And I write to "features/tests.feature" with: """ Feature: Tests diff --git a/features/install_cucumber_rails.feature b/features/install_cucumber_rails.feature index c6f22c75..422fda5c 100644 --- a/features/install_cucumber_rails.feature +++ b/features/install_cucumber_rails.feature @@ -1,10 +1,10 @@ -Feature: Rails 3 +Feature: Rails In order to take over the world Cucumber-Rails should work on major versions - of Rails 3 and Ruby, with Capybara, Spork and DatabaseCleaner + of Rails and Ruby, with Capybara, Spork and DatabaseCleaner Scenario: Install Cucumber-Rails - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails Then the following files should exist: | config/cucumber.yml | | script/cucumber | diff --git a/features/mongoid.feature b/features/mongoid.feature index 929c9503..5f26bb7e 100644 --- a/features/mongoid.feature +++ b/features/mongoid.feature @@ -10,11 +10,12 @@ Feature: Mongoid """ gem "cucumber-rails", :group => :test, :path => '../../..' gem "capybara", :group => :test - gem "database_cleaner", :group => :test - gem "mongoid", :group => :test + gem "database_cleaner", ">= 1.0.0.RC1", :group => :test + gem "mongoid", git: "git://github.com/mongoid/mongoid.git", :group => :test gem "bson_ext", :group => :test """ + And I successfully run `bundle install` And I successfully run `bundle exec rails generate cucumber:install --skip-database` And I successfully run `bundle exec rails generate mongoid:config` And I write to "features/tests.feature" with: @@ -23,6 +24,23 @@ Feature: Mongoid Scenario: Tests When I go to the home page """ + And I write to "app/controllers/home_controller.rb" with: + """ + class HomeController < ActionController::Base + def index + end + end + """ + And I write to "config/routes.rb" with: + """ + CukeApp::Application.routes.draw do + root to: 'home#index' + end + """ + And I write to "app/views/home/index.html.erb" with: + """ + h1 Test App + """ And I write to "features/step_definitions/web_steps.rb" with: """ When /^I go to the home page$/ do @@ -32,8 +50,7 @@ Feature: Mongoid And I overwrite "features/support/env.rb" with: """ require 'cucumber/rails' - DatabaseCleaner.orm = 'mongoid' - DatabaseCleaner.strategy = :truncation + DatabaseCleaner[:mongoid].strategy = :truncation """ And I run `bundle exec rake cucumber` Then it should pass with: diff --git a/features/multiple_databases.feature b/features/multiple_databases.feature index 133185c5..21ecb9e9 100644 --- a/features/multiple_databases.feature +++ b/features/multiple_databases.feature @@ -3,8 +3,8 @@ Feature: Multiple Databases As an engineer I want to specify explicit strategies for each - Background: A Rails 3 app utilizing multiple database repositories exists - Given I have created a new Rails 3 app and installed cucumber-rails + Background: A Rails app utilizing multiple database repositories exists + Given I have created a new Rails app and installed cucumber-rails And I append to "config/database.yml" with: """ @@ -15,9 +15,7 @@ Feature: Multiple Databases And I write to "app/models/bear.rb" with: """ class Bear < ActiveRecord::Base - establish_connection "ursidae" - - attr_accessible :name + establish_connection :ursidae end """ And a directory named "db/migrate" @@ -40,7 +38,7 @@ Feature: Multiple Databases """ require 'cucumber/rails' DatabaseCleaner.strategy = :transaction - DatabaseCleaner[:active_record, {:connection => "ursidae"}].strategy = :truncation + DatabaseCleaner[:active_record, {:connection => :ursidae }].strategy = :truncation """ And I write to "features/create_bear.feature" with: """ @@ -58,7 +56,6 @@ Feature: Multiple Databases Bear.transaction { Bear.find_by_name("yogi").lock! } end """ - Scenario: Default transactional strategy is not attempted on second database When I run `bundle exec rake cucumber FEATURE=features/create_bear.feature` Then it should pass with: diff --git a/features/no_database.feature b/features/no_database.feature index d7bcb777..602669c1 100644 --- a/features/no_database.feature +++ b/features/no_database.feature @@ -2,7 +2,7 @@ Feature: No Database Allow Cucumber to work with a Rails app without a database Scenario: No ActiveRecord and DatabaseCleaner - Given I have created a new Rails 3 app with no database and installed cucumber-rails + Given I have created a new Rails app with no database and installed cucumber-rails # Turn off ActiveRecord And I write to "config/application.rb" with: """ @@ -10,7 +10,6 @@ Feature: No Database require 'action_controller/railtie' require 'action_mailer/railtie' - require 'active_resource/railtie' require 'rails/test_unit/railtie' Bundler.require(:default, Rails.env) if defined?(Bundler) diff --git a/features/rerun_profile.feature b/features/rerun_profile.feature index 306b14c7..e0a5833b 100644 --- a/features/rerun_profile.feature +++ b/features/rerun_profile.feature @@ -4,7 +4,7 @@ Feature: Rerun profile I want to rerun only failing features Scenario: Rerun - Given I have created a new Rails 3 app and installed cucumber-rails + Given I have created a new Rails app and installed cucumber-rails And a file named "rerun.txt" with: """ features/rerun_test.feature:2 diff --git a/features/rest_api.feature b/features/rest_api.feature index 5cabfb0d..1ca471a8 100644 --- a/features/rest_api.feature +++ b/features/rest_api.feature @@ -1,7 +1,7 @@ Feature: REST API Scenario: Compare JSON - Given I have created a new Rails 3 app "rails-3-app" and installed cucumber-rails + Given I have created a new Rails app "rails-app" and installed cucumber-rails And I write to "app/controllers/posts_controller.rb" with: """ class PostsController < ApplicationController @@ -12,7 +12,7 @@ Feature: REST API """ And I write to "config/routes.rb" with: """ - Rails3App::Application.routes.draw do + RailsApp::Application.routes.draw do resources :posts end """ diff --git a/features/routing.feature b/features/routing.feature index 556e0d70..785827c1 100644 --- a/features/routing.feature +++ b/features/routing.feature @@ -1,8 +1,7 @@ Feature: Routing Scenario: Visit undefined route - Given I have created a new Rails 3 app with no database and installed cucumber-rails - And I remove the file "public/index.html" + Given I have created a new Rails app with no database and installed cucumber-rails And I write to "features/tests.feature" with: """ Feature: Tests diff --git a/features/step_definitions/cucumber_rails_steps.rb b/features/step_definitions/cucumber_rails_steps.rb index 14d94015..c09cc0f4 100644 --- a/features/step_definitions/cucumber_rails_steps.rb +++ b/features/step_definitions/cucumber_rails_steps.rb @@ -14,8 +14,9 @@ def install_cucumber_rails(*options) end gem "capybara", :group => :test gem "rspec-rails", :group => :test - gem "database_cleaner", :group => :test unless options.include?(:no_database_cleaner) + gem "database_cleaner", { git: "git://github.com/davebrace/database_cleaner.git", :group => :test } unless options.include?(:no_database_cleaner) gem 'factory_girl', :group => :test unless options.include?(:no_factory_girl) + run_simple 'bundle install' run_simple 'bundle exec rails generate cucumber:install' end @@ -37,28 +38,28 @@ def fixture(path) end World(CucumberRailsHelper) -Given /^I have created a new Rails 3 app and installed cucumber\-rails, accidentally outside of the test group in my Gemfile$/ do +Given /^I have created a new Rails app and installed cucumber\-rails, accidentally outside of the test group in my Gemfile$/ do rails_new install_cucumber_rails :not_in_test_group create_web_steps prepare_aruba_report end -Given /^I have created a new Rails 3 app "([^"]*)" and installed cucumber\-rails$/ do |app_name| +Given /^I have created a new Rails app "([^"]*)" and installed cucumber\-rails$/ do |app_name| rails_new :name => app_name install_cucumber_rails create_web_steps prepare_aruba_report end -Given /^I have created a new Rails 3 app and installed cucumber\-rails$/ do +Given /^I have created a new Rails app and installed cucumber\-rails$/ do rails_new install_cucumber_rails create_web_steps prepare_aruba_report end -Given /^I have created a new Rails 3 app with no database and installed cucumber-rails$/ do +Given /^I have created a new Rails app with no database and installed cucumber-rails$/ do rails_new :args => '--skip-active-record' install_cucumber_rails :no_database_cleaner, :no_factory_girl overwrite_file('features/support/env.rb', "require 'cucumber/rails'\n") diff --git a/gemfiles/rails_3_0.gemfile b/gemfiles/rails_3_0.gemfile index d6b0c40d..47ae1ea8 100644 --- a/gemfiles/rails_3_0.gemfile +++ b/gemfiles/rails_3_0.gemfile @@ -2,6 +2,8 @@ source "https://rubygems.org" +gem "sass-rails" +gem "coffee-rails" gem "rails", "~> 3.0.20" gem "capybara", "~> 2.0.2" gem "turn" diff --git a/gemfiles/rails_4_0.gemfile b/gemfiles/rails_4_0.gemfile new file mode 100644 index 00000000..03b7178d --- /dev/null +++ b/gemfiles/rails_4_0.gemfile @@ -0,0 +1,18 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 4.0.0.beta1" +gem "railties", "~> 4.0.0.beta1" +gem "capybara", "~> 2.0.2" +gem "turn" +gem "rspec-rails" +gem "sass-rails", "~> 4.0.0.beta1" +gem "coffee-rails", "~> 4.0.0.beta1" +gem "uglifier" +gem "jquery-rails" +gem "sqlite3" +gem "bson_ext" +gem "mongoid" + +gemspec :path=>"../" \ No newline at end of file