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/lib/active_uuid/railtie.rb b/lib/active_uuid/railtie.rb index dfa0580..39327b3 100644 --- a/lib/active_uuid/railtie.rb +++ b/lib/active_uuid/railtie.rb @@ -1,4 +1,4 @@ -require "activeuuid" +require "active_uuid" require "rails" module ActiveUUID @@ -6,7 +6,7 @@ class Railtie < Rails::Railtie railtie_name :activeuuid config.to_prepare do - ActiveUUID::Patches.apply! + require "active_uuid/connection_patches" end end end 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