Skip to content

Commit

Permalink
Add missing test dependences to Appraisals
Browse files Browse the repository at this point in the history
Since as of commit 2748b75, we no
longer install dependencies inside of the Rails app that is generated
and used to run all of the tests, we have to require all of the
dependencies that the app would install inside of the appropriate
Appraisals.

This was mostly straightforward except for some workarounds with the
turn gem:

* Rails 3.1 requires two versions of turn depending on which Ruby
  version you're using. On 1.9.2, it uses turn 0.9.2; after 1.9.2, it
  uses ~> 0.9.3. To accommodate this we have to have two versions of the
  Rails 3.1 appraisal which declare the different turn versions.
* Rails 3.1 also loads the turn gem even if, in the Gemfile for the app,
  turn is declared with `require: false`. This causes a problem while
  running our tests because turn actually requires minitest/autorun,
  which adds a hook so when Ruby exits, Minitest tests are run. Because
  we're already using RSpec, Minitest will try to re-run the `rspec`
  command we ran within a Minitest environment. This will fail since we
  are using RSpec-specific command line options to run the tests.
  Unfortunately there's no way to shut off minitest/autorun after it's
  been required, so we have to monkey-patch Minitest's #run method so
it's a no-op.
  • Loading branch information
mcmire committed May 21, 2014
1 parent 380d18f commit f13e069
Show file tree
Hide file tree
Showing 16 changed files with 442 additions and 45 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ matrix:
- rvm: rbx-19mode
- rvm: jruby-19mode
include:
- rvm: 1.9.2
gemfile: gemfiles/3.1_1.9.2.gemfile
- rvm: 1.9.3
gemfile: gemfiles/4.0.0.gemfile
- rvm: 1.9.3
Expand All @@ -34,3 +36,6 @@ matrix:
gemfile: gemfiles/3.2.gemfile
- rvm: jruby-19mode
gemfile: gemfiles/3.2.gemfile
exclude:
- rvm: 1.9.2
gemfile: gemfiles/3.1.gemfile
90 changes: 61 additions & 29 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,53 +1,85 @@
rails_4_0 = proc do
ruby_version = Gem::Version.new(RUBY_VERSION + '')

rails_3 = proc do
gem 'strong_parameters'
end

rails_3_1 = proc do
instance_eval(&rails_3)
gem 'rails', '~> 3.1.8'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'jquery-rails'
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end

rails_4 = proc do
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'sdoc'
gem 'activeresource', '4.0.0'
# Test suite makes heavy use of attr_accessible
gem 'protected_attributes'
end

#---

if RUBY_VERSION < '2.0'
if Gem::Requirement.new('< 2').satisfied_by?(ruby_version)
appraise '3.0' do
instance_eval(&rails_3)
gem 'rails', '~> 3.0.17'
gem 'strong_parameters'
end

appraise '3.1' do
gem 'rails', '~> 3.1.8'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'jquery-rails'
gem 'sass-rails'
gem 'strong_parameters'
if Gem::Requirement.new('= 1.9.2').satisfied_by?(ruby_version)
appraise '3.1-1.9.2' do
instance_eval(&rails_3_1)
gem 'turn', '0.8.2'
end
else
appraise '3.1' do
instance_eval(&rails_3_1)
gem 'turn', '~> 0.8.3'
end
end
end

appraise '3.2' do
instance_eval(&rails_3)
gem 'rails', '~> 3.2.13'
gem 'bcrypt-ruby', '~> 3.0.0'
gem 'jquery-rails'
gem 'sass-rails'
gem 'strong_parameters'
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end

appraise '4.0.0' do
instance_eval(&rails_4_0)
gem 'rails', '4.0.0'
gem 'sass-rails', '4.0.0'
gem 'bcrypt-ruby', '~> 3.0.0'
end
if Gem::Requirement.new('> 1.9.2').satisfied_by?(ruby_version)
appraise '4.0.0' do
instance_eval(&rails_4)
gem 'rails', '4.0.0'
gem 'sass-rails', '~> 4.0.0'
gem 'bcrypt-ruby', '~> 3.0.0'
end

appraise '4.0.1' do
instance_eval(&rails_4_0)
gem 'rails', '4.0.1'
gem 'sass-rails', '4.0.1'
gem 'bcrypt-ruby', '~> 3.1.2'
end
appraise '4.0.1' do
instance_eval(&rails_4)
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'
gem 'bcrypt-ruby', '~> 3.1.2'
end

appraise '4.1' do
instance_eval(&rails_4_0)
gem 'rails', '~> 4.1.0'
gem 'sass-rails', '4.0.3'
gem 'bcrypt-ruby', '~> 3.1.2'
gem "protected_attributes", '~> 1.0.6'
appraise '4.1' do
instance_eval(&rails_4)
gem 'rails', '~> 4.1.0'
gem 'jbuilder', '~> 2.0'
gem 'sass-rails', '~> 4.0.3'
gem 'sdoc', '~> 0.4.0'
gem 'bcrypt', '~> 3.1.7'
gem 'protected_attributes', "~> 1.0.6"
gem 'spring'
end
end
2 changes: 1 addition & 1 deletion gemfiles/3.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
gem "jdbc-sqlite3", :platform=>:jruby
gem "jruby-openssl", :platform=>:jruby
gem "therubyrhino", :platform=>:jruby
gem "rails", "~> 3.0.17"
gem "strong_parameters"
gem "rails", "~> 3.0.17"

gemspec :path=>".././"
7 changes: 5 additions & 2 deletions gemfiles/3.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
gem "jdbc-sqlite3", :platform=>:jruby
gem "jruby-openssl", :platform=>:jruby
gem "therubyrhino", :platform=>:jruby
gem "strong_parameters"
gem "rails", "~> 3.1.8"
gem "bcrypt-ruby", "~> 3.0.0"
gem "jquery-rails"
gem "sass-rails"
gem "strong_parameters"
gem "sass-rails", "~> 3.1.5"
gem "coffee-rails", "~> 3.1.1"
gem "uglifier", ">= 1.0.3"
gem "turn", "~> 0.8.3"

gemspec :path=>".././"
19 changes: 18 additions & 1 deletion gemfiles/3.1.gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ GEM
activesupport (= 3.1.11)
activesupport (3.1.11)
multi_json (~> 1.0)
ansi (1.4.3)
appraisal (1.0.0.beta2)
bundler
rake
Expand All @@ -51,13 +52,21 @@ GEM
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.0)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.7.0)
cucumber (1.2.3)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.11.6)
multi_json (~> 1.3)
diff-lcs (1.2.1)
erubis (2.7.0)
execjs (2.0.2)
ffi (1.4.0)
gherkin (2.11.6)
json (>= 1.7.6)
Expand Down Expand Up @@ -142,7 +151,12 @@ GEM
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
turn (0.8.3)
ansi
tzinfo (0.3.37)
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)

PLATFORMS
ruby
Expand All @@ -155,6 +169,7 @@ DEPENDENCIES
bcrypt-ruby (~> 3.0.0)
bourne (~> 1.3)
bundler (~> 1.1)
coffee-rails (~> 3.1.1)
cucumber (~> 1.1)
jdbc-sqlite3
jquery-rails
Expand All @@ -163,9 +178,11 @@ DEPENDENCIES
rails (~> 3.1.8)
rake (>= 0.9.2)
rspec-rails (>= 2.13.1, < 3)
sass-rails
sass-rails (~> 3.1.5)
shoulda-context (~> 1.2.0)
shoulda-matchers!
sqlite3
strong_parameters
therubyrhino
turn (~> 0.8.3)
uglifier (>= 1.0.3)
21 changes: 21 additions & 0 deletions gemfiles/3.1_1.9.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "shoulda-context", "~> 1.2.0"
gem "sqlite3", :platform=>:ruby
gem "activerecord-jdbc-adapter", :platform=>:jruby
gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
gem "jdbc-sqlite3", :platform=>:jruby
gem "jruby-openssl", :platform=>:jruby
gem "therubyrhino", :platform=>:jruby
gem "strong_parameters"
gem "rails", "~> 3.1.8"
gem "bcrypt-ruby", "~> 3.0.0"
gem "jquery-rails"
gem "sass-rails", "~> 3.1.5"
gem "coffee-rails", "~> 3.1.1"
gem "uglifier", ">= 1.0.3"
gem "turn", "0.8.2"

gemspec :path=>".././"
Loading

0 comments on commit f13e069

Please sign in to comment.