From e4e68427984ae1a767f3698b48aa2dbae34900a5 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Mon, 11 Mar 2019 17:32:19 +0800 Subject: [PATCH] spec: Test that require-ing 'railtie' would not cause errors --- Gemfile | 5 ++++- gemfiles/Rails-5_0.gemfile | 4 +++- gemfiles/Rails-5_1.gemfile | 4 +++- gemfiles/Rails-5_2.gemfile | 4 +++- gemfiles/Rails-head.gemfile | 1 + spec/integration/railtie_spec.rb | 11 +++++++++++ 6 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 spec/integration/railtie_spec.rb diff --git a/Gemfile b/Gemfile index 04fa1c3..5dbb08a 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,11 @@ source "http://rubygems.org" # Specify your gem's dependencies in activeuuid.gemspec gemspec -gem "activerecord", "~>5.0" + +rails_version = "~>5.0" +gem "activerecord", rails_version gem "rake", "< 11.0" gem "codecov", require: false, group: :test +gem "railties", rails_version, require: false, group: :test gem "simplecov", require: false, group: :test diff --git a/gemfiles/Rails-5_0.gemfile b/gemfiles/Rails-5_0.gemfile index 7b374a2..148896f 100644 --- a/gemfiles/Rails-5_0.gemfile +++ b/gemfiles/Rails-5_0.gemfile @@ -2,7 +2,9 @@ source "http://rubygems.org" gemspec path: "../" -gem "activerecord", "~> 5.0.0" +rails_version = "~> 5.0.0" +gem "activerecord", rails_version gem "codecov", require: false, group: :test +gem "railties", rails_version, require: false, group: :test gem "simplecov", require: false, group: :test diff --git a/gemfiles/Rails-5_1.gemfile b/gemfiles/Rails-5_1.gemfile index 3105c3b..f31dd92 100644 --- a/gemfiles/Rails-5_1.gemfile +++ b/gemfiles/Rails-5_1.gemfile @@ -2,7 +2,9 @@ source "http://rubygems.org" gemspec path: "../" -gem "activerecord", "~> 5.1.0" +rails_version = "~> 5.1.0" +gem "activerecord", rails_version gem "codecov", require: false, group: :test +gem "railties", rails_version, require: false, group: :test gem "simplecov", require: false, group: :test diff --git a/gemfiles/Rails-5_2.gemfile b/gemfiles/Rails-5_2.gemfile index ac56928..95596e0 100644 --- a/gemfiles/Rails-5_2.gemfile +++ b/gemfiles/Rails-5_2.gemfile @@ -2,7 +2,9 @@ source "http://rubygems.org" gemspec path: "../" -gem "activerecord", "~> 5.2.0" +rails_version = "~> 5.2.0" +gem "activerecord", rails_version gem "codecov", require: false, group: :test +gem "railties", rails_version, require: false, group: :test gem "simplecov", require: false, group: :test diff --git a/gemfiles/Rails-head.gemfile b/gemfiles/Rails-head.gemfile index a19adfc..a78e7fd 100644 --- a/gemfiles/Rails-head.gemfile +++ b/gemfiles/Rails-head.gemfile @@ -5,4 +5,5 @@ gemspec path: "../" gem "activerecord", github: "rails/rails" gem "codecov", require: false, group: :test +gem "railties", github: "rails/rails", require: false, group: :test gem "simplecov", require: false, group: :test diff --git a/spec/integration/railtie_spec.rb b/spec/integration/railtie_spec.rb new file mode 100644 index 0000000..4edc685 --- /dev/null +++ b/spec/integration/railtie_spec.rb @@ -0,0 +1,11 @@ +require "spec_helper" + +RSpec.describe "railtie" do + it "does not raise error on #require" do + action = -> { + require "rails" + require "active_uuid/railtie" + } + expect(action).to_not raise_error + end +end