diff --git a/.travis.yml b/.travis.yml index 6f34ef8..1bf324b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,6 @@ language: ruby env: - ARUBA_TIMEOUT=240 -before_install: - - gem update --system - - rvm @default,@global do gem uninstall bundler -v 2.0.2 -x cache: bundler rvm: - 2.3 @@ -17,7 +14,6 @@ branches: install: - "bundle install --retry 3 --jobs 8" gemfile: - - gemfiles/rails4.2.gemfile - gemfiles/rails5.0.gemfile - gemfiles/rails5.1.gemfile - gemfiles/rails5.2.gemfile diff --git a/Appraisals b/Appraisals index 9481a2f..f682192 100644 --- a/Appraisals +++ b/Appraisals @@ -1,47 +1,61 @@ # These are the versions of Rails we want to test against. -appraise "rails4.2" do - gem "rails", "~> 4.2.11" - gem "sqlite3", "~> 1.3.6" -end - appraise "rails5.0" do - gem "activerecord", "~> 5.0.7" - gem "railties", "~> 5.0.7" gem "sqlite3", "~> 1.3.6" - gem "actionmailer", "~> 5.0.7" - gem "sass-rails" + gem "byebug" + gem "jbuilder", "~> 2.5" + gem "listen", "~> 3.0.5" + gem "puma", "~> 3.0" + gem "rails", "~> 5.0.7", ">= 5.0.7.2" + gem "sass-rails", "~> 5.0" + gem "spring" + gem "spring-watcher-listen", "~> 2.0.0" + gem "uglifier", ">= 1.3.0" + gem "web-console", ">= 3.3.0", group: :development end appraise "rails5.1" do - gem "activerecord", "~> 5.1.7" - gem "railties", "~> 5.1.7" - gem "actionmailer", "~> 5.1.7" - gem "sass-rails" + gem "byebug" + gem "capybara", ">= 2.15" + gem "jbuilder", "~> 2.5" + gem "listen", ">= 3.0.5", "< 3.2" + gem "puma", "~> 3.7" + gem "rails", "~> 5.1.7" + gem "sass-rails", "~> 5.0" + gem "selenium-webdriver" + gem "spring" + gem "spring-watcher-listen", "~> 2.0.0" + gem "sqlite3", "~> 1.3.6" + gem "web-console", ">= 3.3.0", group: :development end appraise "rails5.2" do - gem "activerecord", "~> 5.2.3" - gem "railties", "~> 5.2.3" - gem "actionmailer", "~> 5.2.3" - gem "bootsnap" - gem "activestorage", "~> 5.2.3" - gem "sass-rails" + gem "byebug" + gem "capybara", ">= 2.15" + gem "chromedriver-helper" + gem "jbuilder", "~> 2.5" + gem "listen", ">= 3.0.5", "< 3.2" + gem "puma", "~> 3.11" + gem "rails", "~> 5.2.4", ">= 5.2.4.2" + gem "sass-rails", "~> 5.0" + gem "selenium-webdriver" + gem "spring" + gem "spring-watcher-listen", "~> 2.0.0" + gem "sqlite3", "~> 1.3.6" + gem "web-console", ">= 3.3.0", group: :development end appraise "rails6.0" do - gem "rails", "~> 6.0.0" - gem "bootsnap" gem "byebug" - gem "capybara" - gem "jbuilder" - gem "listen", "~> 3.1.5" - gem "puma", "~> 3.11" - gem "sass-rails", "~> 5" + gem "capybara", ">= 2.15" + gem "jbuilder", "~> 2.7" + gem "listen", ">= 3.0.5", "< 3.2" + gem "puma", "~> 4.1" + gem "rails", "~> 6.0.2", ">= 6.0.2.2" + gem "sass-rails", ">= 6" gem "selenium-webdriver" gem "spring" - gem "spring-watcher-listen" - gem "turbolinks" - gem "web-console", group: :development + gem "spring-watcher-listen", "~> 2.0.0" + gem "sqlite3", "~> 1.4" + gem "web-console", ">= 3.3.0", group: :development gem "webdrivers" - gem "webpacker" end diff --git a/Gemfile b/Gemfile index ab6f4a2..24dc0a5 100644 --- a/Gemfile +++ b/Gemfile @@ -4,19 +4,8 @@ gemspec name: "factory_bot_rails" gem "appraisal" gem "aruba" -gem "coffee-rails" gem "cucumber", "1.3.19" -gem "jquery-rails" gem "rake" gem "rspec-rails" -gem "test-unit" -gem "uglifier" - -gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby -gem "jdbc-sqlite3", platforms: :jruby -gem "jruby-openssl", platforms: :jruby -gem "therubyrhino", platforms: :jruby - -gem "sqlite3", platforms: :ruby gem "rubocop", "0.54", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 6604207..8a2d42d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,60 +8,42 @@ PATH GEM remote: https://rubygems.org/ specs: - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) - rack (~> 2.0) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) - arel (>= 9.0) - activerecord-jdbc-adapter (52.3-java) - activerecord (~> 5.2.0) - activerecord-jdbcsqlite3-adapter (52.3-java) - activerecord-jdbc-adapter (= 52.3) - jdbc-sqlite3 (~> 3.8, < 3.30) - activesupport (5.2.3) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activesupport (6.0.2.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 2.2) appraisal (2.2.0) bundler rake thor (>= 0.14.0) - arel (9.0.0) - aruba (0.14.12) + aruba (0.14.14) childprocess (>= 0.6.3, < 4.0.0) contracts (~> 0.9) cucumber (>= 1.3.19) ffi (~> 1.9) rspec-expectations (>= 2.99) - thor (~> 0.19) + thor (>= 0.19, < 2.0) ast (2.4.0) - builder (3.2.3) + builder (3.2.4) childprocess (3.0.0) - coffee-rails (5.0.0) - coffee-script (>= 2.2.0) - railties (>= 5.2.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.6) contracts (0.16.0) - crass (1.0.4) + crass (1.0.6) cucumber (1.3.19) builder (>= 2.1.2) diff-lcs (>= 1.1.3) @@ -70,72 +52,64 @@ GEM multi_test (>= 0.1.2) diff-lcs (1.3) erubi (1.9.0) - execjs (2.7.0) - factory_bot (5.1.1) + factory_bot (5.1.2) activesupport (>= 4.2.0) - ffi (1.11.1) - ffi (1.11.1-java) + ffi (1.12.2) + ffi (1.12.2-java) gherkin (2.12.2) multi_json (~> 1.3) gherkin (2.12.2-java) multi_json (~> 1.3) - i18n (1.7.0) + i18n (1.8.2) concurrent-ruby (~> 1.0) - jdbc-sqlite3 (3.28.0) - jquery-rails (4.3.5) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) - jruby-openssl (0.10.2-java) - loofah (2.3.0) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - method_source (0.9.2) + method_source (1.0.0) mini_portile2 (2.4.0) - minitest (5.12.2) - multi_json (1.13.1) + minitest (5.14.0) + multi_json (1.14.1) multi_test (0.1.2) - nokogiri (1.10.4) + nokogiri (1.10.9) mini_portile2 (~> 2.4.0) - nokogiri (1.10.4-java) - parallel (1.17.0) - parser (2.6.5.0) + nokogiri (1.10.9-java) + parallel (1.19.1) + parser (2.7.0.5) ast (~> 2.4.0) - power_assert (1.1.5) powerpack (0.1.2) - rack (2.0.7) + rack (2.2.2) rack-test (1.1.0) rack (>= 1.0, < 3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.2.0) - loofah (~> 2.2, >= 2.2.2) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (>= 0.20.3, < 2.0) rainbow (3.0.0) - rake (13.0.0) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.5) + rake (13.0.1) + rspec-core (3.9.1) + rspec-support (~> 3.9.1) + rspec-expectations (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.2) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.3) + rspec-support (~> 3.9.0) + rspec-rails (4.0.0) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.9.2) rubocop (0.54.0) parallel (~> 1.10) parser (>= 2.5) @@ -144,42 +118,26 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.10.1) - sqlite3 (1.4.1) - test-unit (3.3.4) - power_assert - therubyrhino (2.1.2) - therubyrhino_jar (>= 1.7.4, < 1.7.9) - therubyrhino_jar (1.7.8) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) thread_safe (0.3.6-java) - tzinfo (1.2.5) + tzinfo (1.2.6) thread_safe (~> 0.1) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) - unicode-display_width (1.6.0) + unicode-display_width (1.7.0) + zeitwerk (2.3.0) PLATFORMS java ruby DEPENDENCIES - activerecord-jdbcsqlite3-adapter appraisal aruba - coffee-rails cucumber (= 1.3.19) factory_bot_rails! - jdbc-sqlite3 - jquery-rails - jruby-openssl rake rspec-rails rubocop (= 0.54) - sqlite3 - test-unit - therubyrhino - uglifier BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/features/fixture_replacement_config.feature b/features/fixture_replacement_config.feature index 2d65efd..78b17c8 100644 --- a/features/fixture_replacement_config.feature +++ b/features/fixture_replacement_config.feature @@ -3,8 +3,7 @@ Feature: I would like the Factory Bot Rails gem to configure Factory Bot as the fixture replacement. Background: - Given I successfully run `bundle exec rails new testapp -m ../../features/support/rails_template` - And I cd to "testapp" + Given I create a new rails application And I add "factory_bot_rails" from this project as a dependency Scenario: Using Factory Bot and Factory Bot Rails with Test Unit generates a factory file and does not generate a fixture file diff --git a/features/generators.feature b/features/generators.feature index c85c42d..7f5bcae 100644 --- a/features/generators.feature +++ b/features/generators.feature @@ -4,8 +4,7 @@ Feature: I would like to use factory_bot_rails generators. Background: - Given I successfully run `bundle exec rails new testapp -m ../../features/support/rails_template` - And I cd to "testapp" + Given I create a new rails application And I add "factory_bot_rails" from this project as a dependency And I run `bundle install` with a clean environment diff --git a/features/load_definitions.feature b/features/load_definitions.feature index 85d5236..4c01b9c 100644 --- a/features/load_definitions.feature +++ b/features/load_definitions.feature @@ -1,10 +1,8 @@ Feature: automatically load factory definitions Background: - When I successfully run `bundle exec rails new testapp -m ../../features/support/rails_template` - And I cd to "testapp" + When I create a new rails application And I add "factory_bot_rails" from this project as a dependency - And I add "test-unit" as a dependency And I run `bundle install` with a clean environment And I write to "db/migrate/1_create_users.rb" with: """ diff --git a/features/reloading.feature b/features/reloading.feature index 416bffd..f5cc5aa 100644 --- a/features/reloading.feature +++ b/features/reloading.feature @@ -4,10 +4,8 @@ Feature: So that factory_bot_rails doesn't hold onto stale class references Scenario: Editing a model without editing the factory - When I successfully run `bundle exec rails new testapp -m ../../features/support/rails_template` - And I cd to "testapp" + When I create a new rails application And I add "factory_bot_rails" from this project as a dependency - And I add "test-unit" as a dependency And I run `bundle install` with a clean environment And I write to "db/migrate/1_create_users.rb" with: """ @@ -65,10 +63,8 @@ Feature: And the output should not contain "Failure:" Scenario: Initializing the reloader with I18n support - When I successfully run `bundle exec rails new testapp -m ../../features/support/rails_template` - And I cd to "testapp" + When I create a new rails application And I add "factory_bot_rails" from this project as a dependency - And I add "test-unit" as a dependency And I run `bundle install` with a clean environment And I run `bundle exec rake db:migrate` with a clean environment And I write to "app/models/user.rb" with: diff --git a/features/step_definitions/rails_steps.rb b/features/step_definitions/rails_steps.rb index 9170b09..fbc405c 100644 --- a/features/step_definitions/rails_steps.rb +++ b/features/step_definitions/rails_steps.rb @@ -1,3 +1,14 @@ +When /^I create a new rails application$/ do + options = "--skip-bootsnap --skip-javascript" + template = "-m ../../features/support/rails_template" + result = run_command("bundle exec rails new test_app #{options} #{template}") + + expect(result).to have_output(/README/) + expect(last_command_started).to be_successfully_executed + + cd("test_app") +end + When /^I add "([^"]+)" from this project as a dependency$/ do |gem_name| append_to_file("Gemfile", %{gem "#{gem_name}", :path => "#{PROJECT_ROOT}"\n}) end @@ -16,7 +27,7 @@ end When /^I configure the factories as:$/ do |string| append_to_file File.join("config", "application.rb"), <<~RUBY - class Testapp::Application + class TestApp::Application #{string} end RUBY @@ -24,7 +35,7 @@ end When /^I configure the factories directory as "([^"]+)"$/ do |factory_dir| append_to_file File.join("config", "application.rb"), <<~RUBY - class Testapp::Application + class TestApp::Application config.generators do |g| g.fixture_replacement :factory_bot, :dir => "#{factory_dir}" end diff --git a/features/support/rails_template b/features/support/rails_template index edf8d46..e78f549 100644 --- a/features/support/rails_template +++ b/features/support/rails_template @@ -1 +1,3 @@ -gsub_file "Gemfile", /^gem 'sqlite3'$/, 'gem "sqlite3", "~> 1.3.6"' +if Rails.gem_version < Gem::Version.new('6') + gsub_file "Gemfile", /^gem 'sqlite3'$/, 'gem "sqlite3", "~> 1.3.6"' +end diff --git a/gemfiles/rails4.2.gemfile b/gemfiles/rails4.2.gemfile deleted file mode 100644 index eb476ae..0000000 --- a/gemfiles/rails4.2.gemfile +++ /dev/null @@ -1,22 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal" -gem "aruba" -gem "coffee-rails" -gem "cucumber", "1.3.19" -gem "jquery-rails" -gem "rake" -gem "rspec-rails" -gem "test-unit" -gem "uglifier" -gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby -gem "jdbc-sqlite3", platforms: :jruby -gem "jruby-openssl", platforms: :jruby -gem "therubyrhino", platforms: :jruby -gem "sqlite3", "~> 1.3.6" -gem "rubocop", "0.54", require: false -gem "rails", "~> 4.2.11" - -gemspec name: "factory_bot_rails", path: "../" diff --git a/gemfiles/rails5.0.gemfile b/gemfiles/rails5.0.gemfile index 4ba90e4..4a8e577 100644 --- a/gemfiles/rails5.0.gemfile +++ b/gemfiles/rails5.0.gemfile @@ -4,22 +4,20 @@ source "https://rubygems.org" gem "appraisal" gem "aruba" -gem "coffee-rails" gem "cucumber", "1.3.19" -gem "jquery-rails" gem "rake" gem "rspec-rails" -gem "test-unit" -gem "uglifier" -gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby -gem "jdbc-sqlite3", platforms: :jruby -gem "jruby-openssl", platforms: :jruby -gem "therubyrhino", platforms: :jruby -gem "sqlite3", "~> 1.3.6" gem "rubocop", "0.54", require: false -gem "activerecord", "~> 5.0.7" -gem "railties", "~> 5.0.7" -gem "actionmailer", "~> 5.0.7" -gem "sass-rails" +gem "sqlite3", "~> 1.3.6" +gem "byebug" +gem "jbuilder", "~> 2.5" +gem "listen", "~> 3.0.5" +gem "puma", "~> 3.0" +gem "rails", "~> 5.0.7", ">= 5.0.7.2" +gem "sass-rails", "~> 5.0" +gem "spring" +gem "spring-watcher-listen", "~> 2.0.0" +gem "uglifier", ">= 1.3.0" +gem "web-console", ">= 3.3.0", group: :development gemspec name: "factory_bot_rails", path: "../" diff --git a/gemfiles/rails5.1.gemfile b/gemfiles/rails5.1.gemfile index abd8b86..5f961ab 100644 --- a/gemfiles/rails5.1.gemfile +++ b/gemfiles/rails5.1.gemfile @@ -4,22 +4,21 @@ source "https://rubygems.org" gem "appraisal" gem "aruba" -gem "coffee-rails" gem "cucumber", "1.3.19" -gem "jquery-rails" gem "rake" gem "rspec-rails" -gem "test-unit" -gem "uglifier" -gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby -gem "jdbc-sqlite3", platforms: :jruby -gem "jruby-openssl", platforms: :jruby -gem "therubyrhino", platforms: :jruby -gem "sqlite3", platforms: :ruby gem "rubocop", "0.54", require: false -gem "activerecord", "~> 5.1.7" -gem "railties", "~> 5.1.7" -gem "actionmailer", "~> 5.1.7" -gem "sass-rails" +gem "byebug" +gem "capybara", ">= 2.15" +gem "jbuilder", "~> 2.5" +gem "listen", ">= 3.0.5", "< 3.2" +gem "puma", "~> 3.7" +gem "rails", "~> 5.1.7" +gem "sass-rails", "~> 5.0" +gem "selenium-webdriver" +gem "spring" +gem "spring-watcher-listen", "~> 2.0.0" +gem "sqlite3", "~> 1.3.6" +gem "web-console", ">= 3.3.0", group: :development gemspec name: "factory_bot_rails", path: "../" diff --git a/gemfiles/rails5.2.gemfile b/gemfiles/rails5.2.gemfile index 937b12c..77dfb35 100644 --- a/gemfiles/rails5.2.gemfile +++ b/gemfiles/rails5.2.gemfile @@ -4,24 +4,22 @@ source "https://rubygems.org" gem "appraisal" gem "aruba" -gem "coffee-rails" gem "cucumber", "1.3.19" -gem "jquery-rails" gem "rake" gem "rspec-rails" -gem "test-unit" -gem "uglifier" -gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby -gem "jdbc-sqlite3", platforms: :jruby -gem "jruby-openssl", platforms: :jruby -gem "therubyrhino", platforms: :jruby -gem "sqlite3", platforms: :ruby gem "rubocop", "0.54", require: false -gem "activerecord", "~> 5.2.3" -gem "railties", "~> 5.2.3" -gem "actionmailer", "~> 5.2.3" -gem "bootsnap" -gem "activestorage", "~> 5.2.3" -gem "sass-rails" +gem "byebug" +gem "capybara", ">= 2.15" +gem "chromedriver-helper" +gem "jbuilder", "~> 2.5" +gem "listen", ">= 3.0.5", "< 3.2" +gem "puma", "~> 3.11" +gem "rails", "~> 5.2.4", ">= 5.2.4.2" +gem "sass-rails", "~> 5.0" +gem "selenium-webdriver" +gem "spring" +gem "spring-watcher-listen", "~> 2.0.0" +gem "sqlite3", "~> 1.3.6" +gem "web-console", ">= 3.3.0", group: :development gemspec name: "factory_bot_rails", path: "../" diff --git a/gemfiles/rails6.0.gemfile b/gemfiles/rails6.0.gemfile index ad2a552..9c3ee5f 100644 --- a/gemfiles/rails6.0.gemfile +++ b/gemfiles/rails6.0.gemfile @@ -4,33 +4,22 @@ source "https://rubygems.org" gem "appraisal" gem "aruba" -gem "coffee-rails" gem "cucumber", "1.3.19" -gem "jquery-rails" gem "rake" gem "rspec-rails" -gem "test-unit" -gem "uglifier" -gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby -gem "jdbc-sqlite3", platforms: :jruby -gem "jruby-openssl", platforms: :jruby -gem "therubyrhino", platforms: :jruby -gem "sqlite3", platforms: :ruby gem "rubocop", "0.54", require: false -gem "rails", "~> 6.0.0" -gem "bootsnap" gem "byebug" -gem "capybara" -gem "jbuilder" -gem "listen", "~> 3.1.5" -gem "puma", "~> 3.11" -gem "sass-rails", "~> 5" +gem "capybara", ">= 2.15" +gem "jbuilder", "~> 2.7" +gem "listen", ">= 3.0.5", "< 3.2" +gem "puma", "~> 4.1" +gem "rails", "~> 6.0.2", ">= 6.0.2.2" +gem "sass-rails", ">= 6" gem "selenium-webdriver" gem "spring" -gem "spring-watcher-listen" -gem "turbolinks" -gem "web-console", group: :development +gem "spring-watcher-listen", "~> 2.0.0" +gem "sqlite3", "~> 1.4" +gem "web-console", ">= 3.3.0", group: :development gem "webdrivers" -gem "webpacker" gemspec name: "factory_bot_rails", path: "../"