Permalink
Browse files

Merge pull request #240 from urbanautomaton/multi-gemfile-tests

Multiple-gemfile testing and travis configuration
  • Loading branch information...
2 parents f16e1d2 + e737bd8 commit ac9d843f17813f0d74a12d6489aeafb53635c7da @Kosmas Kosmas committed Mar 4, 2013
Showing with 217 additions and 30 deletions.
  1. +1 −0 .gitignore
  2. +23 −2 .travis.yml
  3. +53 −0 Appraisals
  4. +15 −0 Gemfile
  5. +3 −0 Gemfile.appraisal
  6. +18 −3 README.md
  7. +34 −13 Rakefile
  8. +4 −12 cucumber-rails.gemspec
  9. +17 −0 gemfiles/capybara_1_1.gemfile
  10. +15 −0 gemfiles/rails_3_0.gemfile
  11. +17 −0 gemfiles/rails_3_1.gemfile
  12. +17 −0 gemfiles/rails_3_2.gemfile
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
15 Gemfile
@@ -1,2 +1,17 @@
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,25 @@ 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
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
@@ -13,25 +13,17 @@ 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_development_dependency('rails', '>= 3.2.3')
+ 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('sqlite3', '>= 1.3.6')
s.add_development_dependency('rspec', '~> 2.10.0')
- s.add_development_dependency('rspec-rails', '~> 2.10.1')
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('mongoid', '>= 2.4.9')
- s.add_development_dependency('bson_ext', '>= 1.6.2')
-
- # Various Stuff that Rails 3.1 puts inside apps.
- s.add_development_dependency('turn', '>= 0.9.5')
- s.add_development_dependency('sass-rails', '>= 3.2.5')
- s.add_development_dependency('coffee-rails', '>= 3.2.2')
- s.add_development_dependency('uglifier', '>= 1.2.4')
- s.add_development_dependency('jquery-rails', '>= 2.0.2')
+ s.add_development_dependency('appraisal', '~> 0.5.1')
# For Documentation:
s.add_development_dependency('yard', '~> 0.8.1')
@@ -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=>"../"

0 comments on commit ac9d843

Please sign in to comment.