Permalink
Browse files

Merge branch 'master' of github.com:cucumber/cucumber-rails

Conflicts:
	Gemfile
	cucumber-rails.gemspec
  • Loading branch information...
Kosmas Chatzimichalis
Kosmas Chatzimichalis committed Mar 4, 2013
2 parents 67ec961 + 5b08666 commit 983cf211db0d01db385e779487bd62246fcab2ca
View
@@ -8,3 +8,4 @@ coverage
.rvmrc
Gemfile.lock
.cucumber.rerun
+gemfiles/*.lock
View
@@ -1,14 +1,35 @@
rvm:
- 1.9.3
- 2.0.0
+
# whitelist
branches:
only:
- master
-# Needed for selenium browser
-before_script: sh -e /etc/init.d/xvfb start
+
+gemfile:
+ - gemfiles/rails_3_0.gemfile
+ - gemfiles/rails_3_1.gemfile
+ - gemfiles/rails_3_2.gemfile
+ - gemfiles/capybara_1_1.gemfile
+
+matrix:
+ exclude:
+ - rvm: 2.0.0
+ gemfile: gemfiles/rails_3_0.gemfile
+ - rvm: 2.0.0
+ gemfile: gemfiles/rails_3_1.gemfile
+ - rvm: 2.0.0
+ gemfile: gemfiles/capybara_1_1.gemfile
+
services:
- mongodb
+
+# Needed for selenium browser
+before_script:
+ - "export DISPLAY=:99.0"
+ - "sh -e /etc/init.d/xvfb start"
+
notifications:
email:
- cukes-devs@googlegroups.com
View
@@ -0,0 +1,53 @@
+appraise "rails_3_0" do
+ gem "rails", "~> 3.0.20"
+ gem "capybara", "~> 2.0.2"
+ gem "turn"
+ gem "rspec-rails"
+ gem "jquery-rails"
+ gem "uglifier"
+ gem "sqlite3"
+ gem "bson_ext"
+ gem "mongoid"
+end
+
+appraise "rails_3_1" do
+ gem "rails", "~> 3.1.11"
+ gem "capybara", "~> 2.0.2"
+ gem 'turn'
+ gem 'rspec-rails'
+ gem 'sass-rails'
+ gem 'coffee-rails'
+ gem 'uglifier'
+ gem 'jquery-rails'
+ gem 'sqlite3'
+ gem 'bson_ext'
+ gem 'mongoid'
+end
+
+appraise "rails_3_2" do
+ gem "rails", "~> 3.2.12"
+ gem "capybara", "~> 2.0.2"
+ gem 'turn'
+ gem 'rspec-rails'
+ gem 'sass-rails'
+ gem 'coffee-rails'
+ gem 'uglifier'
+ gem 'jquery-rails'
+ gem 'sqlite3'
+ gem 'bson_ext'
+ gem 'mongoid'
+end
+
+appraise "capybara_1_1" do
+ gem "capybara", "~> 1.1.2"
+ gem "rails", "~> 3.2.12"
+ gem 'turn'
+ gem 'rspec-rails'
+ gem 'sass-rails'
+ gem 'coffee-rails'
+ gem 'uglifier'
+ gem 'jquery-rails'
+ gem 'sqlite3'
+ gem 'bson_ext'
+ gem 'mongoid'
+end
View
17 Gemfile
@@ -1,2 +1,17 @@
-source 'https://rubygems.org'
+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 'turn'
+gem 'rspec-rails'
+gem 'sass-rails'
+gem 'coffee-rails'
+gem 'uglifier'
+gem 'jquery-rails'
+gem 'sqlite3'
+gem 'bson_ext'
+gem 'mongoid'
+
gemspec
View
@@ -0,0 +1,3 @@
+source "https://rubygems.org"
+
+gemspec
View
@@ -54,10 +54,35 @@ I strongly recommend rvm and ruby 1.9.3. When you have that, cd into your cucumb
gem install bundler
bundle install
-### Running all features
+### Running all tests
-With all dependencies installed, all features should pass:
+With all dependencies installed, all specs and features should pass:
- rake cucumber
+ rake
One of the features uses MongoDB, which needs to be running in order to make features/mongoid.feature to pass.
+
+### Running Appraisal suite
+
+In order to test against multiple versions of key dependencies, the [Appraisal](https://github.com/thoughtbot/appraisal) is used to generate multiple gemfiles, stored in the `gemfiles/` directory. Normally these will only run on Travis; however, if you want to run the full test suite against all gemfiles, run the following commands:
+
+ rake gemfiles:install
+ rake test:all
+
+To run the suite against a named gemfile, use the following:
+
+ rake test:gemfile[rails_3_0]
+
+To remove and rebuild the different gemfiles (for example, to update a rails version or its dependencies), use the following:
+
+ rake gemfiles:rebuild
+
+### Adding dependencies
+
+To support the multiple-gemfile testing, when adding a new dependency the following rules apply:
+
+1. If it's a runtime dependency of the gem, add it to the gemspec
+2. If it's a primary development dependency, add it to the gemspec
+3. If it's a dependency of a generated rails app in a test, add it to the Gemfile (for local test runs) and each appraisal section (if necessary).
+
+For example, rspec is a primary development dependency, so it lives in the gemspec. By contrast, coffee-rails is a dependency of apps generated with rails 3.1 and 3.2, so lives in the main Gemfile and the rails 3.1 and 3.2 appraisal sections.
View
@@ -1,28 +1,49 @@
# encoding: utf-8
CUCUMBER_RAILS_VERSION = Gem::Specification.load(File.dirname(__FILE__) + '/cucumber-rails.gemspec').version.version
require 'rubygems'
+require 'bundler'
+require 'bundler/setup'
+require 'appraisal'
require 'rdoc' # https://github.com/lsegal/yard/commit/b861dcc2d7f7e1fbbed7b552ac2e4f7caf68bafa
require 'rake/clean'
-require 'bundler'
+require 'pathname'
Bundler::GemHelper.install_tasks
$:.unshift(File.dirname(__FILE__) + '/lib')
Dir["#{File.dirname(__FILE__)}/dev_tasks/*.rake"].sort.each { |ext| load ext }
CLEAN.include('doc', 'tmp')
-# Needed for selenium browser
-# See http://about.travis-ci.org/docs/user/selenium-setup/
-task :travis do
- ["rspec spec", "rake cucumber"].each do |cmd|
- puts "Starting to run #{cmd}..."
- system("export DISPLAY=:99.0 && bundle exec #{cmd}")
- raise "#{cmd} failed!" unless $?.exitstatus == 0
+task :default => :test
+
+task :test => [:spec, :cucumber]
+
+namespace :test do
+ desc "Run tests against all gemfiles"
+ task :all do
+ Rake::Task['appraisal'].invoke('test')
+ end
+
+ desc "Run tests against specified gemfile, e.g. rake test:gemfile[rails_3_0]"
+ task :gemfile, :name do |task, args|
+ unless args.name && Pathname.new("gemfiles/#{args.name}.gemfile").exist?
+ raise ArgumentError "You must provide the name of an existing Appraisal gemfile, e.g. 'rake test:gemfile[rails_3_2]'"
+ end
+ Rake::Task["appraisal:#{args.name}"].invoke('test')
end
end
-if ENV['TRAVIS']
- task :default => :travis
-else
- task :default => [:spec, :cucumber]
-end
+namespace :gemfiles do
+ desc "Install dependencies for all gemfiles"
+ task :install do
+ ENV['BUNDLE_GEMFILE'] = "Gemfile.appraisal"
+ Rake::Task['appraisal:install'].invoke
+ end
+
+ task :clean do
+ FileUtils.rm_rf("gemfiles/*")
+ end
+
+ desc "Rebuild generated gemfiles and install dependencies"
+ task :rebuild => [:clean, :install]
+end
View
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
s.email = 'cukes@googlegroups.com'
s.homepage = "http://cukes.info"
+<<<<<<< HEAD
s.add_runtime_dependency('cucumber', '>= 1.2.1')
s.add_runtime_dependency('nokogiri', '>= 1.5.6')
s.add_runtime_dependency('capybara', '>= 2.0.2')
@@ -32,6 +33,22 @@ Gem::Specification.new do |s|
s.add_development_dependency('coffee-rails', '>= 3.2.2')
s.add_development_dependency('uglifier', '>= 1.3.0')
s.add_development_dependency('jquery-rails', '>= 2.2.1')
+=======
+ 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')
+
+ # Main development dependencies
+ s.add_development_dependency('rake', '>= 0.9.2.2')
+ s.add_development_dependency('bundler', '>= 1.1.0')
+ s.add_development_dependency('aruba', '>= 0.4.11')
+ 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('appraisal', '~> 0.5.1')
+>>>>>>> 5b086662637c7c654f8c3a70aa07cfb3e7d7edf8
# For Documentation:
s.add_development_dependency('yard', '~> 0.8.5.2')
@@ -0,0 +1,55 @@
+Feature: Disable automatic database cleaning
+
+ By default, a set of Before/After hooks are installed to
+ invoke database_cleaner on every scenario except those tagged
+ "@no-database-cleaner". Sometimes when a user is switching between
+ cleaning strategies, this can initiate an undesired database
+ transaction.
+
+ To avoid the need for users making frequent strategy switches to apply
+ this tag, a configuration option is provided so that the user can
+ control the invocation of database_cleaner explicitly.
+
+ Scenario: Disabling automatic cleaning
+ Given I have created a new Rails 3 app and installed cucumber-rails
+ And I append to "features/env.rb" with:
+ """
+ Cucumber::Rails::Database.autorun_database_cleaner = false
+ """
+ And I write to "features/widgets.feature" with:
+ """
+ Feature: Create widgets
+ Scenario: Create 3 widgets
+ When I create 3 widgets
+ Then I should have 3 widgets
+
+ Scenario: Create 5 widgets
+ When I create 5 widgets
+ Then I should have 8 widgets
+ """
+ And I successfully run `rails generate model widget name:string`
+ And I write to "features/step_definitions/widget_steps.rb" with:
+ """
+ Given /^I have (\d+) widgets$/ do |n|
+ n.to_i.times do |i|
+ Widget.create! :name => "Widget #{Widget.count + i}"
+ end
+ end
+
+ When /^I create (\d+) widgets$/ do |n|
+ n.to_i.times do |i|
+ Widget.create! :name => "Widget #{Widget.count + i}"
+ end
+ end
+
+ Then /^I should have (\d+) widgets$/ do |n|
+ Widget.count.should == n.to_i
+ end
+ """
+ And I run `bundle exec rake db:migrate`
+ And I run `bundle exec rake cucumber`
+ Then it should pass with:
+ """
+ 2 scenarios (2 passed)
+ 4 steps (4 passed)
+ """
@@ -0,0 +1,17 @@
+# This file was generated by Appraisal
+
+source "https://rubygems.org"
+
+gem "capybara", "~> 1.1.2"
+gem "rails", "~> 3.2.12"
+gem "turn"
+gem "rspec-rails"
+gem "sass-rails"
+gem "coffee-rails"
+gem "uglifier"
+gem "jquery-rails"
+gem "sqlite3"
+gem "bson_ext"
+gem "mongoid"
+
+gemspec :path=>"../"
View
@@ -0,0 +1,15 @@
+# This file was generated by Appraisal
+
+source "https://rubygems.org"
+
+gem "rails", "~> 3.0.20"
+gem "capybara", "~> 2.0.2"
+gem "turn"
+gem "rspec-rails"
+gem "jquery-rails"
+gem "uglifier"
+gem "sqlite3"
+gem "bson_ext"
+gem "mongoid"
+
+gemspec :path=>"../"
View
@@ -0,0 +1,17 @@
+# This file was generated by Appraisal
+
+source "https://rubygems.org"
+
+gem "rails", "~> 3.1.11"
+gem "capybara", "~> 2.0.2"
+gem "turn"
+gem "rspec-rails"
+gem "sass-rails"
+gem "coffee-rails"
+gem "uglifier"
+gem "jquery-rails"
+gem "sqlite3"
+gem "bson_ext"
+gem "mongoid"
+
+gemspec :path=>"../"
View
@@ -0,0 +1,17 @@
+# This file was generated by Appraisal
+
+source "https://rubygems.org"
+
+gem "rails", "~> 3.2.12"
+gem "capybara", "~> 2.0.2"
+gem "turn"
+gem "rspec-rails"
+gem "sass-rails"
+gem "coffee-rails"
+gem "uglifier"
+gem "jquery-rails"
+gem "sqlite3"
+gem "bson_ext"
+gem "mongoid"
+
+gemspec :path=>"../"
Oops, something went wrong.

0 comments on commit 983cf21

Please sign in to comment.