Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Rails 5.2 #32

Merged
merged 2 commits into from
Dec 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Lint/EndAlignment:
EnforcedStyleAlignWith: variable

# Indentation of when in a case/when/[else/]end.
Style/CaseIndentation:
Layout/CaseIndentation:
EnforcedStyle: end

#
Expand Down
18 changes: 8 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,23 @@ bundler_args: --no-deployment
branches:
only: master
rvm:
- 2.1.10
- 2.2.6
- 2.3.3
- 2.4.1
- 2.2
- 2.3
- 2.4
gemfile:
- gemfiles/rails3.2.gemfile
- gemfiles/rails4.2.gemfile
- gemfiles/rails5.0.gemfile
- gemfiles/rails5.1.gemfile
- gemfiles/rails5.2.gemfile
matrix:
allow_failures:
- gemfile: gemfiles/rails5.2.gemfile
exclude:
- rvm: 2.4.1
- rvm: 2.4
gemfile: gemfiles/rails3.2.gemfile
- rvm: 2.4.1
- rvm: 2.4
gemfile: gemfiles/rails4.2.gemfile
- rvm: 2.1.10
gemfile: gemfiles/rails5.0.gemfile
- rvm: 2.1.10
gemfile: gemfiles/rails5.1.gemfile
script:
- bundle exec rake rubocop
- bundle exec rake test
12 changes: 5 additions & 7 deletions active_record_host_pool.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# coding: utf-8

require './lib/active_record_host_pool/version'

Gem::Specification.new do |s|
Expand Down Expand Up @@ -27,12 +25,12 @@ Gem::Specification.new do |s|

s.add_runtime_dependency("activerecord", ">= 3.2.0", "< 5.2")

s.add_development_dependency("wwtd")
s.add_development_dependency("mysql2")
s.add_development_dependency("rake", '>= 12.0.0')
s.add_development_dependency("shoulda")
s.add_development_dependency("mocha")
s.add_development_dependency("bump")
s.add_development_dependency("mocha")
s.add_development_dependency("mysql2")
s.add_development_dependency("phenix")
s.add_development_dependency("rake", '>= 12.0.0')
s.add_development_dependency('rubocop', '>= 0.48.0')
s.add_development_dependency("shoulda")
s.add_development_dependency("wwtd")
end
2 changes: 1 addition & 1 deletion gemfiles/rails3.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ gem "mysql2", "~> 0.3.0"
gem "activerecord", "~> 3.2.22"
gem "test-unit-minitest"

eval_gemfile 'gemfiles/common.rb'
eval_gemfile 'common.rb'
2 changes: 1 addition & 1 deletion gemfiles/rails4.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ gemspec :path => "../"

gem "activerecord", "~> 4.2.0"

eval_gemfile 'gemfiles/common.rb'
eval_gemfile 'common.rb'
2 changes: 1 addition & 1 deletion gemfiles/rails5.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ gemspec :path => "../"

gem "activerecord", "~> 5.0.0"

eval_gemfile 'gemfiles/common.rb'
eval_gemfile 'common.rb'
2 changes: 1 addition & 1 deletion gemfiles/rails5.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ gemspec path: '../'

gem 'activerecord', '~> 5.1.3'

eval_gemfile 'gemfiles/common.rb'
eval_gemfile 'common.rb'
7 changes: 7 additions & 0 deletions gemfiles/rails5.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

gemspec path: '../'

gem 'activerecord', '~> 5.2.0.beta2'

eval_gemfile 'common.rb'
80 changes: 80 additions & 0 deletions gemfiles/rails5.2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
PATH
remote: ..
specs:
active_record_host_pool (0.10.1)
activerecord (>= 3.2.0, < 5.2)

GEM
remote: https://rubygems.org/
specs:
activemodel (5.2.0.beta2)
activesupport (= 5.2.0.beta2)
activerecord (5.2.0.beta2)
activemodel (= 5.2.0.beta2)
activesupport (= 5.2.0.beta2)
arel (>= 9.0)
activesupport (5.2.0.beta2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
ast (2.3.0)
bump (0.5.4)
byebug (9.1.0)
concurrent-ruby (1.0.5)
i18n (0.9.1)
concurrent-ruby (~> 1.0)
metaclass (0.0.4)
minitest (5.10.3)
mocha (1.3.0)
metaclass (~> 0.0.1)
mysql2 (0.4.10)
parallel (1.12.0)
parser (2.4.0.2)
ast (~> 2.3)
phenix (0.4.0)
activerecord (>= 3.2, < 5.2)
bundler
powerpack (0.1.1)
rainbow (2.2.2)
rake
rake (12.3.0)
rubocop (0.51.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.2.2)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
thread_safe (0.3.6)
tzinfo (1.2.4)
thread_safe (~> 0.1)
unicode-display_width (1.3.0)
wwtd (1.3.0)

PLATFORMS
ruby

DEPENDENCIES
active_record_host_pool!
activerecord (~> 5.2.0.beta2)
bump
byebug
mocha
mysql2
phenix
rake (>= 12.0.0)
rubocop (>= 0.48.0)
shoulda
wwtd

BUNDLED WITH
1.16.0
4 changes: 2 additions & 2 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module ARHPTestSetup

def arhp_create_models
return if Object.const_defined?('Test1')
eval <<-EOL
eval <<-RUBY
class Test1 < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_host_1_db_1)
Expand Down Expand Up @@ -53,7 +53,7 @@ class Test5 < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_host_2_db_5)
end
EOL
RUBY
end

def current_database(klass)
Expand Down
1 change: 1 addition & 0 deletions test/test_arhp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_connection_proxy_handles_private_methods
# Relies on connection.class returning the real class
Test1.connection.class.class_eval do
private

def test_private_method
true
end
Expand Down
4 changes: 2 additions & 2 deletions test/test_arhp_wrong_db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def test_connecting_to_wrong_db_first
reached_second_exception = false

begin
eval <<-EOC
eval <<-RUBY
class TestNotThere < ActiveRecord::Base
establish_connection(:test_host_1_db_not_there)
connection
end
EOC
RUBY
rescue Exception => e
assert e.message =~ /Unknown database 'arhp_test_no_create'/
reached_first_exception = true
Expand Down