Skip to content

Commit 69d9e3a

Browse files
committed
Cleanup old conditionals
1 parent 6af4645 commit 69d9e3a

2 files changed

Lines changed: 2 additions & 17 deletions

File tree

lib/multidb/candidate.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22

33
module Multidb
44
class Candidate
5-
USE_RAILS_61 = Gem::Version.new(::ActiveRecord::VERSION::STRING) >= Gem::Version.new('6.1')
6-
SPEC_NAME = if USE_RAILS_61
7-
'ActiveRecord::Base'
8-
else
9-
'primary'
10-
end
5+
SPEC_NAME = 'ActiveRecord::Base'
116

127
def initialize(name, target)
138
@name = name
149

1510
case target
1611
when Hash
17-
target = target.merge(name: 'primary') unless USE_RAILS_61
12+
target = target.merge(name: 'primary')
1813

1914
@connection_handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
2015
@connection_handler.establish_connection(target)

spec/lib/multidb/candidate_spec.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,6 @@
1717
handler = subject.instance_variable_get(:@connection_handler)
1818
expect(handler).to an_instance_of(ActiveRecord::ConnectionAdapters::ConnectionHandler)
1919
end
20-
21-
it 'merges the name: primary into the hash', rails: '< 6.1' do
22-
handler = instance_double('ActiveRecord::ConnectionAdapters::ConnectionHandler')
23-
allow(ActiveRecord::ConnectionAdapters::ConnectionHandler).to receive(:new).and_return(handler)
24-
allow(handler).to receive(:establish_connection)
25-
26-
subject
27-
28-
expect(handler).to have_received(:establish_connection).with(hash_including(name: 'primary'))
29-
end
3020
end
3121

3222
context 'when target is a connection handler' do

0 commit comments

Comments
 (0)