From ed95a687d5f3ff258438767df94a3c4e16622ad0 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Sun, 17 Feb 2019 23:17:31 -0700 Subject: [PATCH] Drop obsolete deps, upgrade to new deps * Drop dependency on older versions of RSpec. RSpec 3.x is the only version supported now. * Drop dependency on Minitest 4.x. Minitest 5.x is the only version supported now. * Drop dependency on older versions of Rails. Rails 4.2.x, 5.1.x, and 5.2.x are the only versions supported now. * Drop dependency on older versions of Ruby. Ruby 2.3.x, 2.4.x, and 2.5.x are the only versions supported now. --- .gitignore | 1 - .rubocop.yml | 2 + .ruby-version | 2 +- .travis.yml | 29 +++- Appraisals | 55 +++--- Gemfile | 11 +- Gemfile.lock | 155 +++++++++++++++++ Rakefile | 26 +-- gemfiles/minitest_4_x.gemfile | 7 - gemfiles/minitest_4_x.gemfile.lock | 96 ----------- gemfiles/minitest_5_x.gemfile | 7 - gemfiles/minitest_5_x.gemfile.lock | 102 ------------ gemfiles/rails_3_0.gemfile | 8 - gemfiles/rails_3_0.gemfile.lock | 93 ----------- gemfiles/rails_3_1.gemfile | 10 -- gemfiles/rails_3_1.gemfile.lock | 114 ------------- gemfiles/rails_3_2.gemfile | 10 -- gemfiles/rails_3_2.gemfile.lock | 112 ------------- gemfiles/rails_4_0.gemfile | 10 -- gemfiles/rails_4_0.gemfile.lock | 107 ------------ gemfiles/rails_4_1.gemfile | 10 -- gemfiles/rails_4_1.gemfile.lock | 119 ------------- gemfiles/rails_4_2.gemfile | 15 ++ gemfiles/rails_4_2.gemfile.lock | 143 ++++++++++++++++ gemfiles/rails_5_0.gemfile | 15 ++ gemfiles/rails_5_0.gemfile.lock | 149 +++++++++++++++++ gemfiles/rails_5_1.gemfile | 15 ++ gemfiles/rails_5_1.gemfile.lock | 149 +++++++++++++++++ gemfiles/rails_5_2.gemfile | 15 ++ gemfiles/rails_5_2.gemfile.lock | 157 ++++++++++++++++++ gemfiles/test_unit.gemfile | 7 - gemfiles/test_unit.gemfile.lock | 95 ----------- lib/shoulda/context/assertions.rb | 29 ++-- lib/shoulda/context/context.rb | 2 +- .../context/test_framework_detection.rb | 9 +- shoulda-context.gemspec | 11 +- .../test/shoulda_macros/custom_macro.rb | 2 +- .../shoulda_macros/gem_macro.rb | 3 +- .../shoulda_macros/plugin_macro.rb | 3 +- test/shoulda/autoload_macro_test.rb | 2 +- test/shoulda/context_test.rb | 145 ++++++++++------ test/shoulda/convert_to_should_syntax_test.rb | 12 +- test/shoulda/helpers_test.rb | 83 +++------ test/shoulda/should_test.rb | 102 +++++++++--- test/shoulda/test_framework_detection_test.rb | 134 +++++++-------- test/test_helper.rb | 53 ++++-- 46 files changed, 1221 insertions(+), 1215 deletions(-) create mode 100644 Gemfile.lock delete mode 100644 gemfiles/minitest_4_x.gemfile delete mode 100644 gemfiles/minitest_4_x.gemfile.lock delete mode 100644 gemfiles/minitest_5_x.gemfile delete mode 100644 gemfiles/minitest_5_x.gemfile.lock delete mode 100644 gemfiles/rails_3_0.gemfile delete mode 100644 gemfiles/rails_3_0.gemfile.lock delete mode 100644 gemfiles/rails_3_1.gemfile delete mode 100644 gemfiles/rails_3_1.gemfile.lock delete mode 100644 gemfiles/rails_3_2.gemfile delete mode 100644 gemfiles/rails_3_2.gemfile.lock delete mode 100644 gemfiles/rails_4_0.gemfile delete mode 100644 gemfiles/rails_4_0.gemfile.lock delete mode 100644 gemfiles/rails_4_1.gemfile delete mode 100644 gemfiles/rails_4_1.gemfile.lock create mode 100644 gemfiles/rails_4_2.gemfile create mode 100644 gemfiles/rails_4_2.gemfile.lock create mode 100644 gemfiles/rails_5_0.gemfile create mode 100644 gemfiles/rails_5_0.gemfile.lock create mode 100644 gemfiles/rails_5_1.gemfile create mode 100644 gemfiles/rails_5_1.gemfile.lock create mode 100644 gemfiles/rails_5_2.gemfile create mode 100644 gemfiles/rails_5_2.gemfile.lock delete mode 100644 gemfiles/test_unit.gemfile delete mode 100644 gemfiles/test_unit.gemfile.lock diff --git a/.gitignore b/.gitignore index dde5bf59..dd9d420d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .bundle -Gemfile.lock vendor/ruby vendor/cache doc diff --git a/.rubocop.yml b/.rubocop.yml index a3c61251..21a78c96 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,7 @@ AllCops: TargetRubyVersion: 2.4 + Exclude: + - '*.gemspec' Layout/AlignParameters: EnforcedStyle: with_fixed_indentation Layout/ConditionPosition: diff --git a/.ruby-version b/.ruby-version index cb506813..6a6a3d8e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0-p247 +2.6.1 diff --git a/.travis.yml b/.travis.yml index 46029aff..cf41394e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,28 @@ +language: ruby +sudo: false +cache: + directories: + - vendor/bundle +script: "bundle exec rake" +# Source: +before_install: + - gem update --system '2.7.8' --no-document + - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true + - gem install bundler -v '< 2' --no-document +install: "bundle install --jobs=3 --retry=3 --path vendor/bundle" + rvm: - - 1.9.3 - - 2.0.0 + - 2.6.1 + - 2.5.1 + - 2.4.4 + - 2.3.7 + +env: + - TEST_FRAMEWORK=minitest + - TEST_FRAMEWORK=test_unit + +gemfile: + - gemfiles/rails_4_2.gemfile + - gemfiles/rails_5_0.gemfile + - gemfiles/rails_5_1.gemfile + - gemfiles/rails_5_2.gemfile diff --git a/Appraisals b/Appraisals index f87db936..b634019d 100644 --- a/Appraisals +++ b/Appraisals @@ -1,44 +1,35 @@ -appraise 'rails_3_0' do - gem 'rails', '~> 3.0.0' - gem 'sqlite3' +shared_dependencies = proc do + gem "sqlite3", "~> 1.3.6" end -appraise 'rails_3_1' do - gem 'rails', '~> 3.1.0' - gem 'jquery-rails' - gem 'sass-rails' - gem 'sqlite3' -end +appraise "rails_4_2" do + instance_eval(&shared_dependencies) -appraise 'rails_3_2' do - gem 'rails', '~> 3.2.0' - gem 'jquery-rails' - gem 'sass-rails' - gem 'sqlite3' + gem "rails", "~> 4.2.0" + # gem 'jquery-rails' + # gem 'sass-rails' end -appraise 'rails_4_0' do - gem 'rails', '~> 4.0.0' - gem 'jquery-rails' - gem 'sass-rails' - gem 'sqlite3' -end +appraise "rails_5_0" do + instance_eval(&shared_dependencies) -appraise 'rails_4_1' do - gem 'rails', github: 'rails/rails', branch: '4-1-stable' - gem 'jquery-rails' - gem 'sass-rails' - gem 'sqlite3' + gem "rails", "~> 5.0.0" + # gem 'jquery-rails' + # gem 'sass-rails' end -appraise 'minitest_4_x' do - gem 'minitest', '~> 4.0' -end +appraise "rails_5_1" do + instance_eval(&shared_dependencies) -appraise 'minitest_5_x' do - gem 'minitest', '~> 5.0' + gem "rails", "~> 5.1.0" + # gem 'jquery-rails' + # gem 'sass-rails' end -appraise 'test_unit' do - gem 'test-unit' +appraise "rails_5_2" do + instance_eval(&shared_dependencies) + + gem "rails", "~> 5.2.0" + # gem 'jquery-rails' + # gem 'sass-rails' end diff --git a/Gemfile b/Gemfile index d65e2a66..bf4731e9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,12 @@ -source 'http://rubygems.org' +source "https://rubygems.org" gemspec + +gem "m" +gem "minitest" +gem "mocha" +gem "pry" +gem "pry-byebug" +gem "rails" +gem "rake" +gem "test-unit" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..3d4b3a22 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,155 @@ +PATH + remote: . + specs: + shoulda-context (1.2.2) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.2) + actionpack (= 5.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.2) + actionview (= 5.2.2) + activesupport (= 5.2.2) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.2) + activesupport (= 5.2.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.2) + activesupport (= 5.2.2) + globalid (>= 0.3.6) + activemodel (5.2.2) + activesupport (= 5.2.2) + activerecord (5.2.2) + activemodel (= 5.2.2) + activesupport (= 5.2.2) + arel (>= 9.0) + activestorage (5.2.2) + actionpack (= 5.2.2) + activerecord (= 5.2.2) + marcel (~> 0.3.1) + activesupport (5.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (9.0.0) + builder (3.2.3) + byebug (10.0.2) + coderay (1.1.2) + concurrent-ruby (1.1.4) + crass (1.0.4) + erubi (1.8.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.5.3) + concurrent-ruby (~> 1.0) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + metaclass (0.0.4) + method_source (0.9.2) + mimemagic (0.3.3) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + mocha (1.8.0) + metaclass (~> 0.0.1) + nio4r (2.3.1) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) + power_assert (1.1.3) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) + pry (~> 0.10) + rack (2.0.6) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.2) + actioncable (= 5.2.2) + actionmailer (= 5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) + activemodel (= 5.2.2) + activerecord (= 5.2.2) + activestorage (= 5.2.2) + activesupport (= 5.2.2) + bundler (>= 1.3.0) + railties (= 5.2.2) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.2.2) + actionpack (= 5.2.2) + activesupport (= 5.2.2) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rake (12.3.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + test-unit (3.3.0) + power_assert + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + websocket-driver (0.7.0) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.0) + m + minitest + mocha + pry + pry-byebug + rails + rake + shoulda-context! + test-unit + +BUNDLED WITH + 1.17.3 diff --git a/Rakefile b/Rakefile index e89da1b8..7d6da950 100644 --- a/Rakefile +++ b/Rakefile @@ -1,21 +1,21 @@ -require 'bundler/setup' -require 'bundler/gem_tasks' -require 'rake/testtask' -require 'appraisal' +require "bundler/setup" +require "bundler/gem_tasks" +require "rake/testtask" +require "appraisal" $LOAD_PATH.unshift("lib") -load 'tasks/shoulda.rake' +load "tasks/shoulda.rake" Rake::TestTask.new do |t| - t.libs << 'lib' << 'test' - t.pattern = 'test/**/*_test.rb' + t.libs << "lib" << "test" + t.pattern = "test/**/*_test.rb" t.verbose = false end -desc 'Test the plugin under all supported Rails versions.' -task :all => ['appraisal:cleanup', 'appraisal:install'] do - exec('rake appraisal test') +task :default do + if ENV["CI"] + exec "rake test --trace" + else + exec "appraisal install && appraisal rake test --trace" + end end - -desc 'Default: run tests' -task :default => [:all] diff --git a/gemfiles/minitest_4_x.gemfile b/gemfiles/minitest_4_x.gemfile deleted file mode 100644 index bc82ad99..00000000 --- a/gemfiles/minitest_4_x.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "minitest", "~> 4.0" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/minitest_4_x.gemfile.lock b/gemfiles/minitest_4_x.gemfile.lock deleted file mode 100644 index 6d2fcff9..00000000 --- a/gemfiles/minitest_4_x.gemfile.lock +++ /dev/null @@ -1,96 +0,0 @@ -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (4.0.3) - actionpack (= 4.0.3) - mail (~> 2.5.4) - actionpack (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activemodel (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - activerecord (4.0.3) - activemodel (= 4.0.3) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.3) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - appraisal (0.5.2) - bundler - rake - arel (4.0.2) - atomic (1.1.16) - builder (3.1.4) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.9) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (4.7.5) - mocha (0.9.12) - multi_json (1.9.2) - polyglot (0.3.4) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rails (4.0.3) - actionmailer (= 4.0.3) - actionpack (= 4.0.3) - activerecord (= 4.0.3) - activesupport (= 4.0.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.0.3) - sprockets-rails (~> 2.0.0) - railties (4.0.3) - actionpack (= 4.0.3) - activesupport (= 4.0.3) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.2.1) - sprockets (2.12.0) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - test-unit (2.1.2) - thor (0.19.1) - thread_safe (0.3.1) - atomic (>= 1.1.7, < 2) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - minitest (~> 4.0) - mocha (~> 0.9.10) - rails (>= 3.0) - rake - shoulda-context! - test-unit (~> 2.1.0) diff --git a/gemfiles/minitest_5_x.gemfile b/gemfiles/minitest_5_x.gemfile deleted file mode 100644 index 9f409264..00000000 --- a/gemfiles/minitest_5_x.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "minitest", "~> 5.0" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/minitest_5_x.gemfile.lock b/gemfiles/minitest_5_x.gemfile.lock deleted file mode 100644 index b822e2ae..00000000 --- a/gemfiles/minitest_5_x.gemfile.lock +++ /dev/null @@ -1,102 +0,0 @@ -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - appraisal (0.5.2) - bundler - rake - arel (3.0.3) - builder (3.0.4) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.1) - journey (1.0.4) - json (1.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (5.3.1) - mocha (0.9.12) - multi_json (1.9.2) - polyglot (0.3.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.2.1) - rdoc (3.12.2) - json (~> 1.4) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - test-unit (2.1.2) - thor (0.19.1) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - minitest (~> 5.0) - mocha (~> 0.9.10) - rails (>= 3.0) - rake - shoulda-context! - test-unit (~> 2.1.0) diff --git a/gemfiles/rails_3_0.gemfile b/gemfiles/rails_3_0.gemfile deleted file mode 100644 index 9a73c458..00000000 --- a/gemfiles/rails_3_0.gemfile +++ /dev/null @@ -1,8 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "~> 3.0.0" -gem "sqlite3" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/rails_3_0.gemfile.lock b/gemfiles/rails_3_0.gemfile.lock deleted file mode 100644 index 28adc04e..00000000 --- a/gemfiles/rails_3_0.gemfile.lock +++ /dev/null @@ -1,93 +0,0 @@ -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - abstract (1.0.0) - actionmailer (3.0.20) - actionpack (= 3.0.20) - mail (~> 2.2.19) - actionpack (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - rack (~> 1.2.5) - rack-mount (~> 0.6.14) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.20) - activesupport (= 3.0.20) - builder (~> 2.1.2) - i18n (~> 0.5.0) - activerecord (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - arel (~> 2.0.10) - tzinfo (~> 0.3.23) - activeresource (3.0.20) - activemodel (= 3.0.20) - activesupport (= 3.0.20) - activesupport (3.0.20) - appraisal (0.5.2) - bundler - rake - arel (2.0.10) - builder (2.1.2) - erubis (2.6.6) - abstract (>= 1.0.0) - i18n (0.5.3) - json (1.8.1) - mail (2.2.20) - activesupport (>= 2.3.6) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - mocha (0.9.12) - polyglot (0.3.4) - rack (1.2.8) - rack-mount (0.6.14) - rack (>= 1.0.0) - rack-test (0.5.7) - rack (>= 1.0) - rails (3.0.20) - actionmailer (= 3.0.20) - actionpack (= 3.0.20) - activerecord (= 3.0.20) - activeresource (= 3.0.20) - activesupport (= 3.0.20) - bundler (~> 1.0) - railties (= 3.0.20) - railties (3.0.20) - actionpack (= 3.0.20) - activesupport (= 3.0.20) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.4) - rake (10.2.1) - rdoc (3.12.2) - json (~> 1.4) - sqlite3 (1.3.9) - test-unit (2.1.2) - thor (0.14.6) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - mocha (~> 0.9.10) - rails (~> 3.0.0) - rake - shoulda-context! - sqlite3 - test-unit (~> 2.1.0) diff --git a/gemfiles/rails_3_1.gemfile b/gemfiles/rails_3_1.gemfile deleted file mode 100644 index d16b4442..00000000 --- a/gemfiles/rails_3_1.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "~> 3.1.0" -gem "jquery-rails" -gem "sass-rails" -gem "sqlite3" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/rails_3_1.gemfile.lock b/gemfiles/rails_3_1.gemfile.lock deleted file mode 100644 index 5d074c4a..00000000 --- a/gemfiles/rails_3_1.gemfile.lock +++ /dev/null @@ -1,114 +0,0 @@ -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (3.1.12) - actionpack (= 3.1.12) - mail (~> 2.4.4) - actionpack (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - builder (~> 3.0.0) - erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.6) - rack-cache (~> 1.2) - rack-mount (~> 0.8.2) - rack-test (~> 0.6.1) - sprockets (~> 2.0.4) - activemodel (3.1.12) - activesupport (= 3.1.12) - builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - arel (~> 2.2.3) - tzinfo (~> 0.3.29) - activeresource (3.1.12) - activemodel (= 3.1.12) - activesupport (= 3.1.12) - activesupport (3.1.12) - multi_json (~> 1.0) - appraisal (0.5.2) - bundler - rake - arel (2.2.3) - builder (3.0.4) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.9) - jquery-rails (3.1.0) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.1) - mail (2.4.4) - i18n (>= 0.4.0) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - mocha (0.9.12) - multi_json (1.9.2) - polyglot (0.3.4) - rack (1.3.10) - rack-cache (1.2) - rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.1.12) - actionmailer (= 3.1.12) - actionpack (= 3.1.12) - activerecord (= 3.1.12) - activeresource (= 3.1.12) - activesupport (= 3.1.12) - bundler (~> 1.0) - railties (= 3.1.12) - railties (3.1.12) - actionpack (= 3.1.12) - activesupport (= 3.1.12) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (~> 0.14.6) - rake (10.2.1) - rdoc (3.12.2) - json (~> 1.4) - sass (3.3.4) - sass-rails (3.1.0) - actionpack (~> 3.1.0) - railties (~> 3.1.0) - sass (>= 3.1.4) - sprockets (2.0.4) - hike (~> 1.2) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.9) - test-unit (2.1.2) - thor (0.14.6) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - jquery-rails - mocha (~> 0.9.10) - rails (~> 3.1.0) - rake - sass-rails - shoulda-context! - sqlite3 - test-unit (~> 2.1.0) diff --git a/gemfiles/rails_3_2.gemfile b/gemfiles/rails_3_2.gemfile deleted file mode 100644 index d51f6fe9..00000000 --- a/gemfiles/rails_3_2.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "~> 3.2.0" -gem "jquery-rails" -gem "sass-rails" -gem "sqlite3" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/rails_3_2.gemfile.lock b/gemfiles/rails_3_2.gemfile.lock deleted file mode 100644 index 26d6396c..00000000 --- a/gemfiles/rails_3_2.gemfile.lock +++ /dev/null @@ -1,112 +0,0 @@ -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (3.2.13) - actionpack (= 3.2.13) - mail (~> 2.5.3) - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activerecord (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - appraisal (0.5.2) - bundler - rake - arel (3.0.3) - builder (3.0.4) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.1) - journey (1.0.4) - jquery-rails (3.1.0) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - mocha (0.9.12) - multi_json (1.9.2) - polyglot (0.3.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - rails (3.2.13) - actionmailer (= 3.2.13) - actionpack (= 3.2.13) - activerecord (= 3.2.13) - activeresource (= 3.2.13) - activesupport (= 3.2.13) - bundler (~> 1.0) - railties (= 3.2.13) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.2.1) - rdoc (3.12.2) - json (~> 1.4) - sass (3.3.4) - sass-rails (3.2.6) - railties (~> 3.2.0) - sass (>= 3.1.10) - tilt (~> 1.3) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.9) - test-unit (2.1.2) - thor (0.19.1) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - jquery-rails - mocha (~> 0.9.10) - rails (~> 3.2.0) - rake - sass-rails - shoulda-context! - sqlite3 - test-unit (~> 2.1.0) diff --git a/gemfiles/rails_4_0.gemfile b/gemfiles/rails_4_0.gemfile deleted file mode 100644 index 99ebafc7..00000000 --- a/gemfiles/rails_4_0.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "~> 4.0.0" -gem "jquery-rails" -gem "sass-rails" -gem "sqlite3" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/rails_4_0.gemfile.lock b/gemfiles/rails_4_0.gemfile.lock deleted file mode 100644 index 372ff7fe..00000000 --- a/gemfiles/rails_4_0.gemfile.lock +++ /dev/null @@ -1,107 +0,0 @@ -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (4.0.3) - actionpack (= 4.0.3) - mail (~> 2.5.4) - actionpack (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activemodel (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - activerecord (4.0.3) - activemodel (= 4.0.3) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.3) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - appraisal (0.5.2) - bundler - rake - arel (4.0.2) - atomic (1.1.16) - builder (3.1.4) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.9) - jquery-rails (3.1.0) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (4.7.5) - mocha (0.9.12) - multi_json (1.9.2) - polyglot (0.3.4) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rails (4.0.3) - actionmailer (= 4.0.3) - actionpack (= 4.0.3) - activerecord (= 4.0.3) - activesupport (= 4.0.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.0.3) - sprockets-rails (~> 2.0.0) - railties (4.0.3) - actionpack (= 4.0.3) - activesupport (= 4.0.3) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.2.1) - sass (3.3.4) - sass-rails (4.0.1) - railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) - sprockets (2.12.0) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - sqlite3 (1.3.9) - test-unit (2.1.2) - thor (0.19.1) - thread_safe (0.3.1) - atomic (>= 1.1.7, < 2) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - jquery-rails - mocha (~> 0.9.10) - rails (~> 4.0.0) - rake - sass-rails - shoulda-context! - sqlite3 - test-unit (~> 2.1.0) diff --git a/gemfiles/rails_4_1.gemfile b/gemfiles/rails_4_1.gemfile deleted file mode 100644 index 2373f36f..00000000 --- a/gemfiles/rails_4_1.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", :github=>"rails/rails", :branch=>"4-1-stable" -gem "jquery-rails" -gem "sass-rails" -gem "sqlite3" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/rails_4_1.gemfile.lock b/gemfiles/rails_4_1.gemfile.lock deleted file mode 100644 index af81afb9..00000000 --- a/gemfiles/rails_4_1.gemfile.lock +++ /dev/null @@ -1,119 +0,0 @@ -GIT - remote: git://github.com/rails/rails.git - revision: 5ac4d6e8dd6f11b3291ce85d455ab5aff0abdbfe - branch: 4-1-stable - specs: - actionmailer (4.1.0.rc1) - actionpack (= 4.1.0.rc1) - actionview (= 4.1.0.rc1) - mail (~> 2.5.4) - actionpack (4.1.0.rc1) - actionview (= 4.1.0.rc1) - activesupport (= 4.1.0.rc1) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.0.rc1) - activesupport (= 4.1.0.rc1) - builder (~> 3.1) - erubis (~> 2.7.0) - activemodel (4.1.0.rc1) - activesupport (= 4.1.0.rc1) - builder (~> 3.1) - activerecord (4.1.0.rc1) - activemodel (= 4.1.0.rc1) - activesupport (= 4.1.0.rc1) - arel (~> 5.0.0) - activesupport (4.1.0.rc1) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - rails (4.1.0.rc1) - actionmailer (= 4.1.0.rc1) - actionpack (= 4.1.0.rc1) - actionview (= 4.1.0.rc1) - activemodel (= 4.1.0.rc1) - activerecord (= 4.1.0.rc1) - activesupport (= 4.1.0.rc1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.1.0.rc1) - sprockets-rails (~> 2.0.0) - railties (4.1.0.rc1) - actionpack (= 4.1.0.rc1) - activesupport (= 4.1.0.rc1) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - appraisal (0.5.2) - bundler - rake - arel (5.0.0) - atomic (1.1.16) - builder (3.2.2) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.9) - jquery-rails (3.1.0) - railties (>= 3.0, < 5.0) - thor (>= 0.14, < 2.0) - json (1.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (5.3.1) - mocha (0.9.12) - multi_json (1.9.2) - polyglot (0.3.4) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rake (10.2.1) - sass (3.3.4) - sass-rails (4.0.1) - railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) - sprockets (2.12.0) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - sqlite3 (1.3.9) - test-unit (2.1.2) - thor (0.19.1) - thread_safe (0.3.1) - atomic (>= 1.1.7, < 2) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (1.1.0) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - jquery-rails - mocha (~> 0.9.10) - rails! - rake - sass-rails - shoulda-context! - sqlite3 - test-unit (~> 2.1.0) diff --git a/gemfiles/rails_4_2.gemfile b/gemfiles/rails_4_2.gemfile new file mode 100644 index 00000000..6fa7a5ca --- /dev/null +++ b/gemfiles/rails_4_2.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "m" +gem "minitest" +gem "mocha" +gem "pry" +gem "pry-byebug" +gem "rails", "~> 4.2.0" +gem "rake" +gem "test-unit" +gem "sqlite3", "~> 1.3.6" + +gemspec path: "../" diff --git a/gemfiles/rails_4_2.gemfile.lock b/gemfiles/rails_4_2.gemfile.lock new file mode 100644 index 00000000..16a56f89 --- /dev/null +++ b/gemfiles/rails_4_2.gemfile.lock @@ -0,0 +1,143 @@ +PATH + remote: .. + specs: + shoulda-context (1.2.2) + +GEM + remote: https://rubygems.org/ + specs: + actionmailer (4.2.10) + actionpack (= 4.2.10) + actionview (= 4.2.10) + activejob (= 4.2.10) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.10) + actionview (= 4.2.10) + activesupport (= 4.2.10) + rack (~> 1.6) + rack-test (~> 0.6.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.10) + activesupport (= 4.2.10) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (4.2.10) + activesupport (= 4.2.10) + globalid (>= 0.3.0) + activemodel (4.2.10) + activesupport (= 4.2.10) + builder (~> 3.1) + activerecord (4.2.10) + activemodel (= 4.2.10) + activesupport (= 4.2.10) + arel (~> 6.0) + activesupport (4.2.10) + i18n (~> 0.7) + minitest (~> 5.1) + thread_safe (~> 0.3, >= 0.3.4) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (6.0.4) + builder (3.2.3) + byebug (10.0.2) + coderay (1.1.2) + concurrent-ruby (1.1.4) + crass (1.0.4) + erubis (2.7.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) + mail (2.7.1) + mini_mime (>= 0.1.1) + metaclass (0.0.4) + method_source (0.9.2) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + mocha (1.8.0) + metaclass (~> 0.0.1) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) + power_assert (1.1.3) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) + pry (~> 0.10) + rack (1.6.8) + rack-test (0.6.3) + rack (>= 1.0) + rails (4.2.10) + actionmailer (= 4.2.10) + actionpack (= 4.2.10) + actionview (= 4.2.10) + activejob (= 4.2.10) + activemodel (= 4.2.10) + activerecord (= 4.2.10) + activesupport (= 4.2.10) + bundler (>= 1.3.0, < 2.0) + railties (= 4.2.10) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.8) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (4.2.10) + actionpack (= 4.2.10) + activesupport (= 4.2.10) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + test-unit (3.3.0) + power_assert + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.0) + m + minitest + mocha + pry + pry-byebug + rails (~> 4.2.0) + rake + shoulda-context! + sqlite3 (~> 1.3.6) + test-unit + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/rails_5_0.gemfile b/gemfiles/rails_5_0.gemfile new file mode 100644 index 00000000..c12aab8e --- /dev/null +++ b/gemfiles/rails_5_0.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "m" +gem "minitest" +gem "mocha" +gem "pry" +gem "pry-byebug" +gem "rails", "~> 5.0.0" +gem "rake" +gem "test-unit" +gem "sqlite3", "~> 1.3.6" + +gemspec path: "../" diff --git a/gemfiles/rails_5_0.gemfile.lock b/gemfiles/rails_5_0.gemfile.lock new file mode 100644 index 00000000..7d5d6086 --- /dev/null +++ b/gemfiles/rails_5_0.gemfile.lock @@ -0,0 +1,149 @@ +PATH + remote: .. + specs: + shoulda-context (1.2.2) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.0.7.1) + actionpack (= 5.0.7.1) + nio4r (>= 1.2, < 3.0) + websocket-driver (~> 0.6.1) + actionmailer (5.0.7.1) + actionpack (= 5.0.7.1) + actionview (= 5.0.7.1) + activejob (= 5.0.7.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.0.7.1) + actionview (= 5.0.7.1) + activesupport (= 5.0.7.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.0.7.1) + activesupport (= 5.0.7.1) + builder (~> 3.1) + erubis (~> 2.7.0) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.7.1) + activesupport (= 5.0.7.1) + globalid (>= 0.3.6) + activemodel (5.0.7.1) + activesupport (= 5.0.7.1) + activerecord (5.0.7.1) + activemodel (= 5.0.7.1) + activesupport (= 5.0.7.1) + arel (~> 7.0) + activesupport (5.0.7.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (7.1.4) + builder (3.2.3) + byebug (10.0.2) + coderay (1.1.2) + concurrent-ruby (1.1.4) + crass (1.0.4) + erubis (2.7.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.5.3) + concurrent-ruby (~> 1.0) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) + mail (2.7.1) + mini_mime (>= 0.1.1) + metaclass (0.0.4) + method_source (0.9.2) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + mocha (1.8.0) + metaclass (~> 0.0.1) + nio4r (2.3.1) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) + power_assert (1.1.3) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) + pry (~> 0.10) + rack (2.0.6) + rack-test (0.6.3) + rack (>= 1.0) + rails (5.0.7.1) + actioncable (= 5.0.7.1) + actionmailer (= 5.0.7.1) + actionpack (= 5.0.7.1) + actionview (= 5.0.7.1) + activejob (= 5.0.7.1) + activemodel (= 5.0.7.1) + activerecord (= 5.0.7.1) + activesupport (= 5.0.7.1) + bundler (>= 1.3.0) + railties (= 5.0.7.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.0.7.1) + actionpack (= 5.0.7.1) + activesupport (= 5.0.7.1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + test-unit (3.3.0) + power_assert + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.0) + m + minitest + mocha + pry + pry-byebug + rails (~> 5.0.0) + rake + shoulda-context! + sqlite3 (~> 1.3.6) + test-unit + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/rails_5_1.gemfile b/gemfiles/rails_5_1.gemfile new file mode 100644 index 00000000..933d120b --- /dev/null +++ b/gemfiles/rails_5_1.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "m" +gem "minitest" +gem "mocha" +gem "pry" +gem "pry-byebug" +gem "rails", "~> 5.1.0" +gem "rake" +gem "test-unit" +gem "sqlite3", "~> 1.3.6" + +gemspec path: "../" diff --git a/gemfiles/rails_5_1.gemfile.lock b/gemfiles/rails_5_1.gemfile.lock new file mode 100644 index 00000000..adfce808 --- /dev/null +++ b/gemfiles/rails_5_1.gemfile.lock @@ -0,0 +1,149 @@ +PATH + remote: .. + specs: + shoulda-context (1.2.2) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.1.6.1) + actionpack (= 5.1.6.1) + nio4r (~> 2.0) + websocket-driver (~> 0.6.1) + actionmailer (5.1.6.1) + actionpack (= 5.1.6.1) + actionview (= 5.1.6.1) + activejob (= 5.1.6.1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.1.6.1) + actionview (= 5.1.6.1) + activesupport (= 5.1.6.1) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.1.6.1) + activesupport (= 5.1.6.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.6.1) + activesupport (= 5.1.6.1) + globalid (>= 0.3.6) + activemodel (5.1.6.1) + activesupport (= 5.1.6.1) + activerecord (5.1.6.1) + activemodel (= 5.1.6.1) + activesupport (= 5.1.6.1) + arel (~> 8.0) + activesupport (5.1.6.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (8.0.0) + builder (3.2.3) + byebug (10.0.2) + coderay (1.1.2) + concurrent-ruby (1.1.4) + crass (1.0.4) + erubi (1.8.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.5.3) + concurrent-ruby (~> 1.0) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) + mail (2.7.1) + mini_mime (>= 0.1.1) + metaclass (0.0.4) + method_source (0.9.2) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + mocha (1.8.0) + metaclass (~> 0.0.1) + nio4r (2.3.1) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) + power_assert (1.1.3) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) + pry (~> 0.10) + rack (2.0.6) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.1.6.1) + actioncable (= 5.1.6.1) + actionmailer (= 5.1.6.1) + actionpack (= 5.1.6.1) + actionview (= 5.1.6.1) + activejob (= 5.1.6.1) + activemodel (= 5.1.6.1) + activerecord (= 5.1.6.1) + activesupport (= 5.1.6.1) + bundler (>= 1.3.0) + railties (= 5.1.6.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.1.6.1) + actionpack (= 5.1.6.1) + activesupport (= 5.1.6.1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + test-unit (3.3.0) + power_assert + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.0) + m + minitest + mocha + pry + pry-byebug + rails (~> 5.1.0) + rake + shoulda-context! + sqlite3 (~> 1.3.6) + test-unit + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/rails_5_2.gemfile b/gemfiles/rails_5_2.gemfile new file mode 100644 index 00000000..643bf876 --- /dev/null +++ b/gemfiles/rails_5_2.gemfile @@ -0,0 +1,15 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "m" +gem "minitest" +gem "mocha" +gem "pry" +gem "pry-byebug" +gem "rails", "~> 5.2.0" +gem "rake" +gem "test-unit" +gem "sqlite3", "~> 1.3.6" + +gemspec path: "../" diff --git a/gemfiles/rails_5_2.gemfile.lock b/gemfiles/rails_5_2.gemfile.lock new file mode 100644 index 00000000..d5f4f1aa --- /dev/null +++ b/gemfiles/rails_5_2.gemfile.lock @@ -0,0 +1,157 @@ +PATH + remote: .. + specs: + shoulda-context (1.2.2) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.2) + actionpack (= 5.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.2) + actionview (= 5.2.2) + activesupport (= 5.2.2) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.2) + activesupport (= 5.2.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.2) + activesupport (= 5.2.2) + globalid (>= 0.3.6) + activemodel (5.2.2) + activesupport (= 5.2.2) + activerecord (5.2.2) + activemodel (= 5.2.2) + activesupport (= 5.2.2) + arel (>= 9.0) + activestorage (5.2.2) + actionpack (= 5.2.2) + activerecord (= 5.2.2) + marcel (~> 0.3.1) + activesupport (5.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (9.0.0) + builder (3.2.3) + byebug (10.0.2) + coderay (1.1.2) + concurrent-ruby (1.1.4) + crass (1.0.4) + erubi (1.8.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.5.3) + concurrent-ruby (~> 1.0) + loofah (2.2.3) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + metaclass (0.0.4) + method_source (0.9.2) + mimemagic (0.3.3) + mini_mime (1.0.1) + mini_portile2 (2.4.0) + minitest (5.11.3) + mocha (1.8.0) + metaclass (~> 0.0.1) + nio4r (2.3.1) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) + power_assert (1.1.3) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) + pry (~> 0.10) + rack (2.0.6) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.2) + actioncable (= 5.2.2) + actionmailer (= 5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) + activemodel (= 5.2.2) + activerecord (= 5.2.2) + activestorage (= 5.2.2) + activesupport (= 5.2.2) + bundler (>= 1.3.0) + railties (= 5.2.2) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.2.2) + actionpack (= 5.2.2) + activesupport (= 5.2.2) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rake (12.3.2) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + test-unit (3.3.0) + power_assert + thor (0.20.3) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + websocket-driver (0.7.0) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bundler (~> 1.0) + m + minitest + mocha + pry + pry-byebug + rails (~> 5.2.0) + rake + shoulda-context! + sqlite3 (~> 1.3.6) + test-unit + +BUNDLED WITH + 1.17.3 diff --git a/gemfiles/test_unit.gemfile b/gemfiles/test_unit.gemfile deleted file mode 100644 index 042c6485..00000000 --- a/gemfiles/test_unit.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "test-unit" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/test_unit.gemfile.lock b/gemfiles/test_unit.gemfile.lock deleted file mode 100644 index a3e0bd65..00000000 --- a/gemfiles/test_unit.gemfile.lock +++ /dev/null @@ -1,95 +0,0 @@ -PATH - remote: ../ - specs: - shoulda-context (1.1.6) - -GEM - remote: http://rubygems.org/ - specs: - actionmailer (4.0.3) - actionpack (= 4.0.3) - mail (~> 2.5.4) - actionpack (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activemodel (4.0.3) - activesupport (= 4.0.3) - builder (~> 3.1.0) - activerecord (4.0.3) - activemodel (= 4.0.3) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.3) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.3) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - appraisal (0.5.2) - bundler - rake - arel (4.0.2) - atomic (1.1.16) - builder (3.1.4) - erubis (2.7.0) - hike (1.2.3) - i18n (0.6.9) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mime-types (1.25.1) - minitest (4.7.5) - mocha (0.9.12) - multi_json (1.9.2) - polyglot (0.3.4) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - rails (4.0.3) - actionmailer (= 4.0.3) - actionpack (= 4.0.3) - activerecord (= 4.0.3) - activesupport (= 4.0.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.0.3) - sprockets-rails (~> 2.0.0) - railties (4.0.3) - actionpack (= 4.0.3) - activesupport (= 4.0.3) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.2.1) - sprockets (2.12.0) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) - test-unit (2.5.5) - thor (0.19.1) - thread_safe (0.3.1) - atomic (>= 1.1.7, < 2) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - tzinfo (0.3.38) - -PLATFORMS - ruby - -DEPENDENCIES - appraisal (~> 0.5) - mocha (~> 0.9.10) - rails (>= 3.0) - rake - shoulda-context! - test-unit diff --git a/lib/shoulda/context/assertions.rb b/lib/shoulda/context/assertions.rb index 84b5d82f..f2732a08 100644 --- a/lib/shoulda/context/assertions.rb +++ b/lib/shoulda/context/assertions.rb @@ -3,7 +3,7 @@ module Context module Assertions # Asserts that two arrays contain the same elements, the same number of times. Essentially ==, but unordered. # - # assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes + # assert_same_elements([:a, :b, :c], [:c, :a, :b]) => passes) def assert_same_elements(a1, a2, msg = nil) [:select, :inject, :size].each do |m| [a1, a2].each {|a| assert_respond_to(a, m, "Are you sure that #{a.inspect} is an array? It doesn't respond to #{m}.") } @@ -45,7 +45,8 @@ def assert_does_not_contain(collection, x, extra_msg = "") end end - # Asserts that the given matcher returns true when +target+ is passed to #matches? + # Asserts that the given matcher returns true when +target+ is passed to + # #matches? def assert_accepts(matcher, target, options = {}) if matcher.respond_to?(:in_context) matcher.in_context(self) @@ -54,33 +55,35 @@ def assert_accepts(matcher, target, options = {}) if matcher.matches?(target) safe_assert_block { true } if options[:message] - message = matcher.respond_to?(:failure_message_for_should_not) ? matcher.failure_message_for_should_not : matcher.negative_failure_message - assert_match options[:message], message + assert_match options[:message], matcher.failure_message_when_negated end else - message = matcher.respond_to?(:failure_message_for_should) ? matcher.failure_message_for_should : matcher.failure_message - safe_assert_block(message) { false } + safe_assert_block(matcher.failure_message) { false } end end - # Asserts that the given matcher returns true when +target+ is passed to #does_not_match? - # or false when +target+ is passed to #matches? if #does_not_match? is not implemented + # Asserts that the given matcher returns true when +target+ is passed to + # #does_not_match? or false when +target+ is passed to #matches? if + # #does_not_match? is not implemented def assert_rejects(matcher, target, options = {}) if matcher.respond_to?(:in_context) matcher.in_context(self) end - not_match = matcher.respond_to?(:does_not_match?) ? matcher.does_not_match?(target) : !matcher.matches?(target) + not_match = + if matcher.respond_to?(:does_not_match?) + matcher.does_not_match?(target) + else + !matcher.matches?(target) + end if not_match safe_assert_block { true } if options[:message] - message = matcher.respond_to?(:failure_message_for_should) ? matcher.failure_message_for_should : matcher.failure_message - assert_match options[:message], message + assert_match options[:message], matcher.failure_message end else - message = matcher.respond_to?(:failure_message_for_should_not) ? matcher.failure_message_for_should_not : matcher.negative_failure_message - safe_assert_block(message) { false } + safe_assert_block(matcher.failure_message_when_negated) { false } end end diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index cff68603..848f7822 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -473,7 +473,7 @@ def build end def test_name_prefix - if defined?(Minitest) || defined?(MiniTest) + if defined?(Minitest) 'test_:' else 'test:' diff --git a/lib/shoulda/context/test_framework_detection.rb b/lib/shoulda/context/test_framework_detection.rb index ae274bda..1157362f 100644 --- a/lib/shoulda/context/test_framework_detection.rb +++ b/lib/shoulda/context/test_framework_detection.rb @@ -3,10 +3,9 @@ module Context module TestFrameworkDetection def self.possible_test_frameworks [ - lambda { ActiveSupport::TestCase }, - lambda { Minitest::Test }, - lambda { MiniTest::Unit::TestCase }, - lambda { Test::Unit::TestCase } + -> { ActiveSupport::TestCase }, + -> { Minitest::Test }, + -> { Test::Unit::TestCase } ] end @@ -23,7 +22,7 @@ def self.detected_test_framework_test_cases end def self.test_framework_test_cases - @_test_framework_test_case ||= detected_test_framework_test_cases + @_test_framework_test_cases ||= detected_test_framework_test_cases end end diff --git a/shoulda-context.gemspec b/shoulda-context.gemspec index f36c1027..c891d939 100644 --- a/shoulda-context.gemspec +++ b/shoulda-context.gemspec @@ -17,14 +17,9 @@ Gem::Specification.new do |s| s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- exe/*`.split("\n").map{ |f| File.basename(f) } + s.bindir = 'exe' s.require_paths = ["lib"] - s.add_development_dependency("appraisal", "~> 0.5") - s.add_development_dependency("rails", ">= 3.0") - s.add_development_dependency("mocha", "~> 0.9.10") - s.add_development_dependency("rake") - s.add_development_dependency("test-unit", "~> 2.1.0") - s.add_development_dependency("pry") - s.add_development_dependency("byebug") - s.add_development_dependency("pry-byebug") + s.add_development_dependency "appraisal" + s.add_development_dependency "bundler", "~> 1.0" end diff --git a/test/fake_rails_root/test/shoulda_macros/custom_macro.rb b/test/fake_rails_root/test/shoulda_macros/custom_macro.rb index ffae9e8e..0e68ecb8 100644 --- a/test/fake_rails_root/test/shoulda_macros/custom_macro.rb +++ b/test/fake_rails_root/test/shoulda_macros/custom_macro.rb @@ -2,5 +2,5 @@ module CustomMacro def custom_macro end end -Test::Unit::TestCase.extend(CustomMacro) +PARENT_TEST_CASE.extend(CustomMacro) diff --git a/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb b/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb index 6c470767..2bf92621 100644 --- a/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb +++ b/test/fake_rails_root/vendor/gems/gem_with_macro-0.0.1/shoulda_macros/gem_macro.rb @@ -2,5 +2,4 @@ module GemMacro def gem_macro end end -Test::Unit::TestCase.extend(GemMacro) - +PARENT_TEST_CASE.extend(GemMacro) diff --git a/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb b/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb index 4c3ba165..2a5aa8f4 100644 --- a/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb +++ b/test/fake_rails_root/vendor/plugins/plugin_with_macro/shoulda_macros/plugin_macro.rb @@ -2,5 +2,4 @@ module PluginMacro def plugin_macro end end -Test::Unit::TestCase.extend(PluginMacro) - +PARENT_TEST_CASE.extend(PluginMacro) diff --git a/test/shoulda/autoload_macro_test.rb b/test/shoulda/autoload_macro_test.rb index 99c2a5ad..a19b4984 100644 --- a/test/shoulda/autoload_macro_test.rb +++ b/test/shoulda/autoload_macro_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class AutoloadMacroTest < Test::Unit::TestCase # :nodoc: +class AutoloadMacroTest < PARENT_TEST_CASE context "The macro auto-loader" do should "load macros from the plugins" do assert self.class.respond_to?('plugin_macro') diff --git a/test/shoulda/context_test.rb b/test/shoulda/context_test.rb index 581db0ef..61036e93 100644 --- a/test/shoulda/context_test.rb +++ b/test/shoulda/context_test.rb @@ -1,7 +1,6 @@ require 'test_helper' -class ContextTest < Test::Unit::TestCase # :nodoc: - +class ContextTest < PARENT_TEST_CASE def self.context_macro(&blk) context "with a subcontext made by a macro" do setup { @context_macro = :foo } @@ -20,7 +19,7 @@ def self.context_macro(&blk) end should "have name set right" do - assert_match(/^test: context with setup block/, self.to_s) + assert_match(/^test: context with setup block/, normalized_name) end context "and a subcontext" do @@ -29,7 +28,7 @@ def self.context_macro(&blk) end should "be named correctly" do - assert_match(/^test: context with setup block and a subcontext should be named correctly/, self.to_s) + assert_match(/^test: context with setup block and a subcontext should be named correctly/, normalized_name) end should "run the setup blocks in order" do @@ -39,7 +38,7 @@ def self.context_macro(&blk) context_macro do should "have name set right" do - assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, self.to_s) + assert_match(/^test: context with setup block with a subcontext made by a macro should have name set right/, normalized_name) end should "run the setup block of that context macro" do @@ -63,7 +62,7 @@ def self.context_macro(&blk) end should "have name set right" do - assert_match(/^test: another context with setup block/, self.to_s) + assert_match(/^test: another context with setup block/, normalized_name) end end @@ -77,7 +76,7 @@ def hello; "hi"; end end should "have name set right" do - assert_match(/^test: context with method definition/, self.to_s) + assert_match(/^test: context with method definition/, normalized_name) end end @@ -166,19 +165,22 @@ class ::SomeModel; end end end + def normalized_name + name.sub("test_:", "test:") + end end class ::Some class NestedModel; end end -class Some::NestedModelTest < Test::Unit::TestCase +class Some::NestedModelTest < PARENT_TEST_CASE should "determine the described type for a nested model" do assert_equal Some::NestedModel, self.class.described_type end end -class Some::SomeTest < Test::Unit::TestCase +class Some::SomeTest < PARENT_TEST_CASE should "not fallback to higher-level constants with same name" do assert_raises(NameError) do assert_equal nil, self.class.described_type @@ -186,13 +188,13 @@ class Some::SomeTest < Test::Unit::TestCase end end -class ShouldMatcherTest < Test::Unit::TestCase +class ShouldMatcherTest < PARENT_TEST_CASE class FakeMatcher attr_reader :subject attr_accessor :fail def description - "do something" + "be a fake matcher" end def matches?(subject) @@ -200,46 +202,33 @@ def matches?(subject) !@fail end - def failure_message_for_should - "failure message for should" + def failure_message + "positive failure message" end - def failure_message_for_should_not - "failure message for should not" + def failure_message_when_negated + "negative failure message" end end - def run_test_suite - @test_suite.run(@test_result) { |event, name| } - end - def setup @matcher = FakeMatcher.new - @test_result = Test::Unit::TestResult.new - class << @test_result - def failure_messages - @failures.map { |failure| failure.message } - end - end - end - - def create_test_suite(&definition) - test_class = Class.new(Test::Unit::TestCase, &definition) - test_class.suite end - def assert_failed_with(message, test_result) - assert_equal 1, test_result.failure_count - assert_equal [message], test_result.failure_messages + def assert_failed_with(message, test_suite) + assert_equal [message], test_suite.failure_messages end - def assert_passed(test_result) - assert_equal 0, test_result.failure_count + def assert_passed(test_suite) + assert_equal [], test_suite.failure_messages end def assert_test_named(expected_name, test_suite) - name = test_suite.tests.map { |test| test.method_name }.first - assert name.include?(expected_name), "Expected #{name} to include #{expected_name}" + name = test_suite.test_names.first + assert( + name.include?(expected_name), + "Expected #{name} to include #{expected_name}" + ) end def self.should_use_positive_matcher @@ -249,19 +238,19 @@ def self.should_use_positive_matcher should "pass with a passing matcher" do @matcher.fail = false - run_test_suite - assert_passed @test_result + @test_suite.run + assert_passed @test_suite end should "fail with a failing matcher" do @matcher.fail = true - run_test_suite - assert_failed_with "failure message for should", @test_result + @test_suite.run + assert_failed_with "positive failure message", @test_suite end should "provide the subject" do @matcher.fail = false - run_test_suite + @test_suite.run assert_equal 'a subject', @matcher.subject end end @@ -273,19 +262,19 @@ def self.should_use_negative_matcher should "pass with a failing matcher" do @matcher.fail = true - run_test_suite - assert_passed @test_result + @test_suite.run + assert_passed @test_suite end should "fail with a passing matcher" do @matcher.fail = false - run_test_suite - assert_failed_with "failure message for should not", @test_result + @test_suite.run + assert_failed_with "negative failure message", @test_suite end should "provide the subject" do @matcher.fail = false - run_test_suite + @test_suite.run assert_equal 'a subject', @matcher.subject end end @@ -293,7 +282,7 @@ def self.should_use_negative_matcher context "a should block with a matcher" do setup do matcher = @matcher - @test_suite = create_test_suite do + @test_suite = TestSuite.create do subject { 'a subject' } should matcher end @@ -305,7 +294,7 @@ def self.should_use_negative_matcher context "a should block with a matcher within a context" do setup do matcher = @matcher - @test_suite = create_test_suite do + @test_suite = TestSuite.create do context "in context" do subject { 'a subject' } should matcher @@ -319,7 +308,7 @@ def self.should_use_negative_matcher context "a should_not block with a matcher" do setup do matcher = @matcher - @test_suite = create_test_suite do + @test_suite = TestSuite.create do subject { 'a subject' } should_not matcher end @@ -331,7 +320,7 @@ def self.should_use_negative_matcher context "a should_not block with a matcher within a context" do setup do matcher = @matcher - @test_suite = create_test_suite do + @test_suite = TestSuite.create do context "in context" do subject { 'a subject' } should_not matcher @@ -341,11 +330,61 @@ def self.should_use_negative_matcher should_use_negative_matcher end + + class TestSuite + def self.create(&definition) + if defined?(Test::Unit) + TestUnitSuite.new(&definition) + else + MinitestSuite.new(&definition) + end + end + end + + class TestUnitSuite + def initialize(&definition) + @suite = Class.new(Test::Unit::TestCase, &definition).suite + @result = Test::Unit::TestResult.new + end + + def run + @suite.run(@result) do |event, name| + # do nothing + end + end + + def failure_messages + @result.failures.map(&:message) + end + + def test_names + @suite.tests.map(&:method_name) + end + end + + class MinitestSuite + def initialize(&definition) + @test_case_class = Class.new(Minitest::Test, &definition) + @reporter = Minitest::StatisticsReporter.new(StringIO.new) + end + + def run + @test_case_class.run(@reporter) + end + + def failure_messages + @reporter.results.flat_map(&:failures).map(&:message) + end + + def test_names + @test_case_class.runnable_methods + end + end end class Subject; end -class SubjectTest < Test::Unit::TestCase +class SubjectTest < PARENT_TEST_CASE def setup @expected = Subject.new @@ -358,7 +397,7 @@ def setup end end -class SubjectLazinessTest < Test::Unit::TestCase +class SubjectLazinessTest < PARENT_TEST_CASE subject { Subject.new } should "only build the subject once" do diff --git a/test/shoulda/convert_to_should_syntax_test.rb b/test/shoulda/convert_to_should_syntax_test.rb index 7d71bc76..c984f728 100644 --- a/test/shoulda/convert_to_should_syntax_test.rb +++ b/test/shoulda/convert_to_should_syntax_test.rb @@ -1,9 +1,8 @@ -require 'test/unit' - -class ConvertToShouldSyntaxTest < Test::Unit::TestCase # :nodoc: +require 'test_helper' +class ConvertToShouldSyntaxTest < PARENT_TEST_CASE BEFORE_FIXTURE = <<-EOS - class DummyTest < Test::Unit::TestCase + class DummyTest < #{PARENT_TEST_CASE} should "Not change this_word_with_underscores" do end @@ -23,7 +22,7 @@ def non_test_method EOS AFTER_FIXTURE = <<-EOS - class DummyTest < Test::Unit::TestCase + class DummyTest < #{PARENT_TEST_CASE} should "Not change this_word_with_underscores" do end @@ -48,7 +47,7 @@ def non_test_method def test_convert_to_should_syntax File.open(FIXTURE_PATH, "w") {|f| f.write(BEFORE_FIXTURE)} - cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), '../../bin/convert_to_should_syntax')} #{FIXTURE_PATH}" + cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), '../../exe/convert_to_should_syntax')} #{FIXTURE_PATH}" output = `#{cmd}` File.unlink($1) if output.match(/has been stored in '([^']+)/) assert_match(/has been converted/, output) @@ -59,5 +58,4 @@ def test_convert_to_should_syntax def teardown File.unlink(FIXTURE_PATH) end - end diff --git a/test/shoulda/helpers_test.rb b/test/shoulda/helpers_test.rb index 3999e19d..cbce79e3 100644 --- a/test/shoulda/helpers_test.rb +++ b/test/shoulda/helpers_test.rb @@ -1,7 +1,6 @@ require 'test_helper' -class HelpersTest < Test::Unit::TestCase # :nodoc: - +class HelpersTest < PARENT_TEST_CASE context "an array of values" do setup do @a = ['abc', 'def', 3] @@ -9,7 +8,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: [/b/, 'abc', 3].each do |x| should "contain #{x.inspect}" do - assert_raises(Test::Unit::AssertionFailedError) do + assert_raises(ASSERTION_CLASS) do assert_does_not_contain @a, x end assert_contains @a, x @@ -17,17 +16,17 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: end should "not contain 'wtf'" do - assert_raises(Test::Unit::AssertionFailedError) {assert_contains @a, 'wtf'} + assert_raises(ASSERTION_CLASS) {assert_contains @a, 'wtf'} assert_does_not_contain @a, 'wtf' end should "be the same as another array, ordered differently" do assert_same_elements(@a, [3, "def", "abc"]) - assert_raises(Test::Unit::AssertionFailedError) do + assert_raises(ASSERTION_CLASS) do assert_same_elements(@a, [3, 3, "def", "abc"]) end assert_same_elements([@a, "abc"].flatten, ["abc", 3, "def", "abc"]) - assert_raises(Test::Unit::AssertionFailedError) do + assert_raises(ASSERTION_CLASS) do assert_same_elements([@a, "abc"].flatten, [3, 3, "def", "abc"]) end end @@ -41,9 +40,12 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: context "a matching matcher" do setup do - @matcher = stub('matcher', :matches? => true, - :failure_message_for_should => 'bad failure message', - :failure_message_for_should_not => 'big time failure') + @matcher = stub( + "matcher", + matches?: true, + failure_message: "bad failure message", + failure_message_when_negated: "big time failure" + ) end should "pass when given to assert_accepts with no message expectation" do @@ -55,7 +57,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: end should "fail when given to assert_accepts with non-matching message" do - assert_raise Test::Unit::AssertionFailedError do + assert_raises ASSERTION_CLASS do assert_accepts @matcher, 'target', :message => /small time/ end end @@ -68,7 +70,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: @matcher.stubs(:matches?).returns(false) @matcher.stubs(:does_not_match?).returns(true) assert_rejects @matcher, 'target' - rescue Test::Unit::AssertionFailedError => @error + rescue ASSERTION_CLASS => @error end end @@ -82,12 +84,12 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: @error = nil begin assert_rejects @matcher, 'target' - rescue Test::Unit::AssertionFailedError => @error + rescue ASSERTION_CLASS => @error end end should "fail" do - assert_not_nil @error + refute_nil @error end should "use the error message from the matcher" do @@ -99,49 +101,12 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: context "a non-matching matcher" do setup do - @matcher = stub('matcher', :matches? => false, - :failure_message_for_should => 'big time failure', - :failure_message_for_should_not => 'bad failure message') - end - - should "pass when given to assert_rejects with no message expectation" do - assert_rejects @matcher, 'target' - end - - should "pass when given to assert_rejects with a matching message" do - assert_rejects @matcher, 'target', :message => /big time/ - end - - should "fail when given to assert_rejects with a non-matching message" do - assert_raise Test::Unit::AssertionFailedError do - assert_rejects @matcher, 'target', :message => /small time/ - end - end - - context "when given to assert_accepts" do - setup do - begin - assert_accepts @matcher, 'target' - rescue Test::Unit::AssertionFailedError => @error - end - end - - should "fail" do - assert_not_nil @error - end - - should "use the error message from the matcher" do - assert_equal 'big time failure', @error.message - end - end - end - - - context "a matcher using antiquated syntax" do - setup do - @matcher = stub('matcher', :matches? => false, - :failure_message => 'big time failure', - :negative_failure_message => 'bad failure message') + @matcher = stub( + "matcher", + matches?: false, + failure_message: "big time failure", + failure_message_when_negated: "bad failure message" + ) end should "pass when given to assert_rejects with no message expectation" do @@ -153,7 +118,7 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: end should "fail when given to assert_rejects with a non-matching message" do - assert_raise Test::Unit::AssertionFailedError do + assert_raises ASSERTION_CLASS do assert_rejects @matcher, 'target', :message => /small time/ end end @@ -162,12 +127,12 @@ class HelpersTest < Test::Unit::TestCase # :nodoc: setup do begin assert_accepts @matcher, 'target' - rescue Test::Unit::AssertionFailedError => @error + rescue ASSERTION_CLASS => @error end end should "fail" do - assert_not_nil @error + refute_nil @error end should "use the error message from the matcher" do diff --git a/test/shoulda/should_test.rb b/test/shoulda/should_test.rb index d4bb4e3a..64530aa4 100644 --- a/test/shoulda/should_test.rb +++ b/test/shoulda/should_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class ShouldTest < Test::Unit::TestCase # :nodoc: +class ShouldTest < PARENT_TEST_CASE should "be able to define a should statement outside of a context" do assert true end @@ -19,7 +19,7 @@ def self.should_be_able_to_setup_a_should_eventually_in_a_class_method should "be able to setup a should eventually in a class method" end - def self.should_see_a_context_block_like_a_Test_Unit_class + def self.should_see_a_context_block_like_a_test_case_class should "see a context block as a Test::Unit class" do assert_equal "ShouldTest", self.class.name end @@ -40,14 +40,22 @@ def self.should_not_see_blah def self.should_be_able_to_make_context_macros(prefix = nil) context "a macro" do should "have the tests named correctly" do - assert_match(/^test: #{prefix}a macro should have the tests named correctly/, self.to_s) + assert_match( + Regexp.new( + "^" + + build_expected_test_name( + "#{prefix}a macro should have the tests named correctly" + ) + ), + test_name + ) end end end context "Context" do should_see_class_methods - should_see_a_context_block_like_a_Test_Unit_class + should_see_a_context_block_like_a_test_case_class should_be_able_to_make_context_macros("Context ") should_be_able_to_setup_a_should_eventually_in_a_class_method @@ -81,7 +89,13 @@ def self.should_be_able_to_make_context_macros(prefix = nil) should_see_blah should "have name set right" do - assert_match(/^test: Context with setup block/, self.to_s) + assert_match( + Regexp.new( + "^" + + build_expected_test_name("Context with setup block") + ), + test_name + ) end context "and a subcontext" do @@ -90,7 +104,15 @@ def self.should_be_able_to_make_context_macros(prefix = nil) end should "be named correctly" do - assert_match(/^test: Context with setup block and a subcontext should be named correctly/, self.to_s) + assert_match( + Regexp.new( + "^" + + build_expected_test_name( + "Context with setup block and a subcontext should be named correctly" + ) + ), + test_name + ) end should "run the setup methods in order" do @@ -110,7 +132,13 @@ def self.should_be_able_to_make_context_macros(prefix = nil) end should "have name set right" do - assert_match(/^test: Another context with setup block/, self.to_s) + assert_match( + Regexp.new( + "^" + + build_expected_test_name("Another context with setup block") + ), + test_name + ) end should_see_blah end @@ -123,14 +151,14 @@ def self.should_be_able_to_make_context_macros(prefix = nil) def test_should_create_a_new_context assert_nothing_raised do - Shoulda::Context::Context.new("context name", self) do; end + Shoulda::Context::Context.new("context name", self.class) do; end end end def test_should_create_a_new_context_even_if_block_is_omitted old_verbose, $VERBOSE = $VERBOSE, nil assert_nothing_raised do - Shoulda::Context::Context.new("context without a block", self) + Shoulda::Context::Context.new("context without a block", self.class) end ensure $VERBOSE = old_verbose @@ -138,14 +166,14 @@ def test_should_create_a_new_context_even_if_block_is_omitted def test_should_create_a_nested_context assert_nothing_raised do - parent = Shoulda::Context::Context.new("Parent", self) do; end + parent = Shoulda::Context::Context.new("Parent", self.class) do; end child = Shoulda::Context::Context.new("Child", parent) do; end raise unless child.instance_of? Shoulda::Context::Context end end def test_should_name_a_contexts_correctly - parent = Shoulda::Context::Context.new("Parent", self) do; end + parent = Shoulda::Context::Context.new("Parent", self.class) do; end child = Shoulda::Context::Context.new("Child", parent) do; end grandchild = Shoulda::Context::Context.new("GrandChild", child) do; end @@ -155,12 +183,11 @@ def test_should_name_a_contexts_correctly end def test_should_raise_on_duplicate_naming - tu_class = Test::Unit::TestCase - context = Shoulda::Context::Context.new("DupContext", tu_class) do + context = Shoulda::Context::Context.new("DupContext", self.class) do should "dup" do; end should "dup" do; end end - assert_raise DuplicateTestError do + assert_raises DuplicateTestError do context.build end end @@ -168,7 +195,7 @@ def test_should_raise_on_duplicate_naming # Should statements def test_should_have_should_hashes_when_given_should_statements - context = Shoulda::Context::Context.new("name", self) do + context = Shoulda::Context::Context.new("name", self.class) do should "be good" do; end should "another" do; end end @@ -180,7 +207,7 @@ def test_should_have_should_hashes_when_given_should_statements # setup and teardown def test_should_capture_setup_and_teardown_blocks - context = Shoulda::Context::Context.new("name", self) do + context = Shoulda::Context::Context.new("name", self.class) do setup do; "setup"; end teardown do; "teardown"; end end @@ -192,7 +219,7 @@ def test_should_capture_setup_and_teardown_blocks # building def test_should_create_shoulda_test_for_each_should_on_build - context = Shoulda::Context::Context.new("name", self) do + context = Shoulda::Context::Context.new("name", self.class) do should "one" do; end should "two" do; end end @@ -202,44 +229,54 @@ def test_should_create_shoulda_test_for_each_should_on_build end def test_should_create_test_methods_on_build - tu_class = Test::Unit::TestCase + tu_class = self.class context = Shoulda::Context::Context.new("A Context", tu_class) do should "define the test" do; end end - tu_class.expects(:define_method).with(:"test: A Context should define the test. ") + tu_class. + expects(:define_method). + with( + build_expected_test_name("A Context should define the test. ").to_sym + ) context.build end def test_should_create_test_methods_on_build_when_subcontext - tu_class = Test::Unit::TestCase + tu_class = self.class context = Shoulda::Context::Context.new("A Context", tu_class) do context "with a child" do should "define the test" do; end end end - tu_class.expects(:define_method).with(:"test: A Context with a child should define the test. ") + tu_class. + expects(:define_method). + with( + build_expected_test_name( + "A Context with a child should define the test. " + ).to_sym + ) context.build end # Test::Unit integration - def test_should_create_a_new_context_and_build_it_on_Test_Unit_context + def test_should_create_a_new_context_and_build_it_on_test_case_context c = mock("context") c.expects(:build) Shoulda::Context::Context.expects(:new).with("foo", kind_of(Class)).returns(c) self.class.context "foo" do; end end - def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should + def test_should_create_a_one_off_context_and_build_it_on_test_case_should s = mock("test") Shoulda::Context::Context.any_instance.expects(:should).with("rock", {}).returns(s) Shoulda::Context::Context.any_instance.expects(:build) self.class.should "rock" do; end end - def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should_eventually + def test_should_create_a_one_off_context_and_build_it_on_test_case_should_eventually s = mock("test") Shoulda::Context::Context.any_instance.expects(:should_eventually).with("rock").returns(s) Shoulda::Context::Context.any_instance.expects(:build) @@ -288,4 +325,21 @@ def test_should_create_a_one_off_context_and_build_it_on_Test_Unit_should_eventu end end + def test_name + name + end + + def build_expected_test_name(name) + if TEST_FRAMEWORK == "minitest" + "test_: #{name}" + else + "test: #{name}" + end + end + + # Minitest removed assert_nothing_raised a while back; + # see here: + def assert_nothing_raised + yield + end end diff --git a/test/shoulda/test_framework_detection_test.rb b/test/shoulda/test_framework_detection_test.rb index 2276cc9a..68a96da8 100644 --- a/test/shoulda/test_framework_detection_test.rb +++ b/test/shoulda/test_framework_detection_test.rb @@ -1,78 +1,57 @@ -require 'test_helper' -require 'tempfile' +require "test_helper" +require "tempfile" -class TestFrameworkDetectionTest < Test::Unit::TestCase - if CURRENT_APPRAISAL_NAME == 'rails_4_1' - should 'detect Minitest 5.x w/ Rails 4.1' do - assert_integration_with_rails_and 'Minitest::Test', 'Minitest::Unit::TestCase' +class TestFrameworkDetectionTest < PARENT_TEST_CASE + if CURRENT_APPRAISAL_NAME == "rails_5_2" + should "detect Minitest 5.x w/ Rails 5.2" do + assert_integration_with_rails_and "Minitest::Test" end end - if CURRENT_APPRAISAL_NAME == 'rails_4_0' - should 'detect ActiveSupport::TestCase and Minitest 4.x w/ Rails 4.0' do - assert_integration_with_rails_and 'MiniTest::Unit::TestCase' + if CURRENT_APPRAISAL_NAME == "rails_5_1" + should "detect Minitest 5.x w/ Rails 5.1" do + assert_integration_with_rails_and "Minitest::Test" end end - if CURRENT_APPRAISAL_NAME == 'rails_3_2' - should 'detect ActiveSupport::TestCase and Test::Unit::TestCase w/ Rails 3.2' do - assert_integration_with_rails_and 'Test::Unit::TestCase' + if CURRENT_APPRAISAL_NAME == "rails_5_0" + should "detect Minitest 5.x w/ Rails 5.0" do + assert_integration_with_rails_and "Minitest::Test" end end - if CURRENT_APPRAISAL_NAME == 'rails_3_1' - should 'detect ActiveSupport::TestCase and Test::Unit::TestCase w/ Rails 3.1' do - assert_integration_with_rails_and 'Test::Unit::TestCase' + if CURRENT_APPRAISAL_NAME == "rails_4_2" + should "detect ActiveSupport::TestCase and Minitest 4.x w/ Rails 4.2" do + assert_integration_with_rails_and "Minitest::Test" end end - if CURRENT_APPRAISAL_NAME == 'rails_3_0' - should 'detect ActiveSupport::TestCase and Test::Unit::TestCase w/ Rails 3.0' do - assert_integration_with_rails_and 'Test::Unit::TestCase' + if TEST_FRAMEWORK == "minitest" + should "detect Minitest 5.x when it is loaded standalone" do + assert_integration_with "Minitest::Test", setup: <<-RUBY + require "minitest/autorun" + RUBY end end - if CURRENT_APPRAISAL_NAME == 'minitest_5_x' - should 'detect Minitest 5.x when it is loaded standalone' do - assert_integration_with 'Minitest::Test', 'Minitest::Unit::TestCase', + if TEST_FRAMEWORK == "test_unit" + should "detect the test-unit gem when it is loaded standalone" do + assert_integration_with "Test::Unit::TestCase", setup: <<-RUBY - require 'minitest/autorun' + require "test/unit" RUBY end end - if CURRENT_APPRAISAL_NAME == 'minitest_4_x' - should 'detect Minitest 4.x when it is loaded standalone' do - assert_integration_with 'MiniTest::Unit::TestCase', - setup: <<-RUBY - require 'minitest/autorun' - RUBY - end - end - - if CURRENT_APPRAISAL_NAME == 'test_unit' - should 'detect the test-unit gem when it is loaded standalone' do - assert_integration_with 'Test::Unit::TestCase', - setup: <<-RUBY - require 'test/unit' - RUBY - end - end - - def assert_integration_with(*test_cases) - assert_test_cases_are_detected(*test_cases) - assert_our_api_is_available_in_test_cases(*test_cases) - end - def assert_integration_with_rails_and(*test_cases) - test_cases = ['ActiveSupport::TestCase'] | test_cases + test_cases = ["ActiveSupport::TestCase"] | test_cases options = test_cases.last.is_a?(Hash) ? test_cases.pop : {} options[:setup] = <<-RUBY - require 'rails/all' - require 'rails/test_help' + require "rails/all" + require "rails/test_help" ActiveRecord::Base.establish_connection( - adapter: 'sqlite3', - database: ':memory:' + adapter: "sqlite3", + database: ":memory:" ) RUBY args = test_cases + [options] @@ -80,43 +59,54 @@ def assert_integration_with_rails_and(*test_cases) assert_integration_with(*args) end + def assert_integration_with(*test_cases) + assert_test_cases_are_detected(*test_cases) + assert_our_api_is_available_in_test_cases(*test_cases) + end + def assert_test_cases_are_detected(*expected_test_cases) options = expected_test_cases.last.is_a?(Hash) ? expected_test_cases.pop : {} - setup = options[:setup] || '' + setup = options[:setup] || "" output = execute(file_that_detects_test_framework_test_cases([setup])) - actual_test_cases = output.split("\n").first.split(', ') + actual_test_cases = output.split("\n").first.split(", ") assert_equal expected_test_cases, actual_test_cases end def file_that_detects_test_framework_test_cases(mixins) <<-RUBY #{require_gems(mixins)} - require 'yaml' - test_cases = Shoulda::Context.test_framework_test_cases.map { |test_case| test_case.to_s } + require "yaml" + test_cases = + Shoulda::Context.test_framework_test_cases.map do |test_case| + test_case.to_s + end puts test_cases.join(', ') RUBY end def require_gems(mixins) <<-RUBY - ENV['BUNDLE_GEMFILE'] = "#{PROJECT_DIR}/gemfiles/#{CURRENT_APPRAISAL_NAME}.gemfile" - require 'bundler' + ENV["BUNDLE_GEMFILE"] = + "#{PROJECT_DIR}/gemfiles/#{CURRENT_APPRAISAL_NAME}.gemfile" + require "bundler" Bundler.setup #{mixins.join("\n")} - require 'shoulda-context' + require "shoulda-context" RUBY end def assert_our_api_is_available_in_test_cases(*test_cases) options = test_cases.last.is_a?(Hash) ? test_cases.pop : {} - setup = options[:setup] || '' + setup = options[:setup] || "" test_cases.each do |test_case| - output = execute(file_that_runs_a_test_within_test_case(test_case, [setup])) - assert_match /1 (tests|runs)/, output - assert_match /1 assertions/, output - assert_match /0 failures/, output - assert_match /0 errors/, output + output = execute( + file_that_runs_a_test_within_test_case(test_case, [setup]) + ) + assert_match(/1 (tests|runs)/, output) + assert_match(/1 assertions/, output) + assert_match(/0 failures/, output) + assert_match(/0 errors/, output) end end @@ -125,8 +115,8 @@ def file_that_runs_a_test_within_test_case(test_case, mixins) #{require_gems(mixins)} class FrameworkIntegrationTest < #{test_case} - context 'a context' do - should 'have a test' do + context "a context" do + should "have a test" do assert_equal true, true end end @@ -135,20 +125,22 @@ class FrameworkIntegrationTest < #{test_case} end def execute(code) - tempfile = Tempfile.new('shoulda-context-test') + tempfile = Tempfile.new("shoulda-context-test") tempfile.write(code) tempfile.close - if ENV['DEBUG'] - puts 'Code:' + if ENV["DEBUG"] + puts "Code:" puts code end - output = `RUBYOPT='' ruby #{tempfile.path} 2>&1` - if ENV['DEBUG'] - puts 'Output:' + output = `RUBYOPT="" ruby #{tempfile.path} 2>/dev/null` + + if ENV["DEBUG"] + puts "Output:" puts output end + output end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 3e91df17..4ba5e532 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,16 +1,47 @@ -require 'fileutils' -require 'test/unit' -require 'mocha' +TEST_FRAMEWORK = ENV.fetch("TEST_FRAMEWORK", "minitest") -if ENV['BUNDLE_GEMFILE'].to_s.empty? - raise "No Appraisal is specified. Please re-run your tests with BUNDLE_GEMFILE set." +if TEST_FRAMEWORK == "test_unit" + require "test-unit" + require "mocha/test_unit" +else + require "minitest/autorun" + require "mocha/minitest" end -PROJECT_DIR = File.expand_path('../..', __FILE__) -CURRENT_APPRAISAL_NAME = File.basename(ENV['BUNDLE_GEMFILE'], '.gemfile') +require "pry-byebug" +require "appraisal" +require "fileutils" -$LOAD_PATH << File.join(PROJECT_DIR, 'lib') -require 'shoulda/context' +appraisal_in_use = + Pathname.new(ENV["BUNDLE_GEMFILE"]).expand_path.dirname == + Pathname.new("../../gemfiles").expand_path(__FILE__) -Shoulda.autoload_macros File.join(File.dirname(__FILE__), 'fake_rails_root'), - File.join("vendor", "{plugins,gems}", "*") +unless appraisal_in_use + raise <<-MSG +No Appraisal is specified. + +Please run tests starting with `appraisal `. +Possible appraisals are: #{Appraisal::AppraisalFile.each.map(&:name)} + MSG +end + +PROJECT_DIR = File.expand_path("..", __dir__) +CURRENT_APPRAISAL_NAME = File.basename(ENV["BUNDLE_GEMFILE"], ".gemfile") +PARENT_TEST_CASE = + if TEST_FRAMEWORK == "test_unit" + Test::Unit::TestCase + else + Minitest::Test + end +ASSERTION_CLASS = + if TEST_FRAMEWORK == "test_unit" + Test::Unit::AssertionFailedError + else + Minitest::Assertion + end + +$LOAD_PATH << File.join(PROJECT_DIR, "lib") +require "shoulda/context" + +Shoulda.autoload_macros File.join(File.dirname(__FILE__), "fake_rails_root"), + File.join("vendor", "{plugins,gems}", "*")