Skip to content

Commit c6e6df7

Browse files
authored
Merge pull request #467 from rails-sqlserver/fix-minitest-deprecations
Fix minitest global matchers warnings
2 parents 7fb8580 + daf5c9a commit c6e6df7

File tree

5 files changed

+103
-93
lines changed

5 files changed

+103
-93
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
213213
state of the client and the need to use Result#cancel to stop processing active results. It is also
214214
safe to call Result#cancel over and over again.
215215
* Look for the syb headers only.
216+
* Fix minitest global matchers warnings.
216217

217218

218219
## 0.3.2

test/client_test.rb

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
require 'test_helper'
33

44
class ClientTest < TinyTds::TestCase
5-
6-
describe 'With valid credentials' do
7-
5+
describe 'with valid credentials' do
86
before do
97
@client = new_connection
108
end
@@ -174,57 +172,68 @@ class ClientTest < TinyTds::TestCase
174172

175173
end
176174

177-
describe 'Private methods' do
178-
175+
describe '#parse_username' do
179176
let(:client) { @client = new_connection }
180177

181-
it '#parse_username returns username if azure is not true' do
182-
username = 'user@abc123.database.windows.net'
183-
client.send(:parse_username, username: username).must_equal username
178+
it 'returns username if azure is not true' do
179+
_(
180+
client.send(:parse_username, username: 'user@abc123.database.windows.net')
181+
).must_equal 'user@abc123.database.windows.net'
184182
end
185183

186-
it '#parse_username returns short username if azure is true' do
187-
client.send(:parse_username,
188-
username: 'user@abc123.database.windows.net',
189-
host: 'abc123.database.windows.net',
190-
azure: true
184+
it 'returns short username if azure is true' do
185+
_(
186+
client.send(
187+
:parse_username,
188+
username: 'user@abc123.database.windows.net',
189+
host: 'abc123.database.windows.net',
190+
azure: true
191+
)
191192
).must_equal 'user@abc123'
192193
end
193194

194-
it '#parse_username returns full username if azure is false' do
195-
client.send(:parse_username,
196-
username: 'user@abc123.database.windows.net',
197-
host: 'abc123.database.windows.net',
198-
azure: false
195+
it 'returns full username if azure is false' do
196+
_(
197+
client.send(
198+
:parse_username,
199+
username: 'user@abc123.database.windows.net',
200+
host: 'abc123.database.windows.net',
201+
azure: false
202+
)
199203
).must_equal 'user@abc123.database.windows.net'
200204
end
201205

202-
it '#parse_username returns short username if passed and azure is true' do
203-
client.send(:parse_username,
204-
username: 'user@abc123',
205-
host: 'abc123.database.windows.net',
206-
azure: true
206+
it 'returns short username if passed and azure is true' do
207+
_(
208+
client.send(
209+
:parse_username,
210+
username: 'user@abc123',
211+
host: 'abc123.database.windows.net',
212+
azure: true
213+
)
207214
).must_equal 'user@abc123'
208215
end
209216

210-
it '#parse_username returns username with servername if passed and azure is true' do
211-
client.send(:parse_username,
212-
username: 'user',
213-
host: 'abc123.database.windows.net',
214-
azure: true
217+
it 'returns username with servername if passed and azure is true' do
218+
_(
219+
client.send(
220+
:parse_username,
221+
username: 'user',
222+
host: 'abc123.database.windows.net',
223+
azure: true
224+
)
215225
).must_equal 'user@abc123'
216226
end
217227

218-
it '#parse_username returns username with servername if passed and azure is false' do
219-
client.send(:parse_username,
220-
username: 'user',
221-
host: 'abc123.database.windows.net',
222-
azure: false
228+
it 'returns username with servername if passed and azure is false' do
229+
_(
230+
client.send(
231+
:parse_username,
232+
username: 'user',
233+
host: 'abc123.database.windows.net',
234+
azure: false
235+
)
223236
).must_equal 'user'
224237
end
225-
226238
end
227-
228-
229239
end
230-

test/gem_test.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,33 @@ class GemTest < MiniTest::Spec
2121
let(:root_path) { TinyTds::Gem.root_path }
2222

2323
it 'should be the root path' do
24-
root_path.must_equal gem_root
24+
_(root_path).must_equal gem_root
2525
end
2626

2727
it 'should be the root path no matter the cwd' do
2828
Dir.chdir '/'
2929

30-
root_path.must_equal gem_root
30+
_(root_path).must_equal gem_root
3131
end
3232
end
3333

3434
describe '#ports_root_path' do
3535
let(:ports_root_path) { TinyTds::Gem.ports_root_path }
3636

3737
it 'should be the ports path' do
38-
ports_root_path.must_equal File.join(gem_root,'ports')
38+
_(ports_root_path).must_equal File.join(gem_root,'ports')
3939
end
4040

4141
it 'should be the ports path no matter the cwd' do
4242
Dir.chdir '/'
4343

44-
ports_root_path.must_equal File.join(gem_root,'ports')
44+
_(ports_root_path).must_equal File.join(gem_root,'ports')
4545
end
4646
end
4747

4848
describe '#ports_bin_paths' do
4949
let(:ports_bin_paths) { TinyTds::Gem.ports_bin_paths }
50-
50+
5151
describe 'when the ports directories exist' do
5252
let(:fake_bin_paths) do
5353
ports_host_root = File.join(gem_root, 'ports', 'fake-host-with-dirs')
@@ -74,12 +74,12 @@ class GemTest < MiniTest::Spec
7474
end
7575

7676
it 'should return all the bin directories' do
77-
ports_bin_paths.sort.must_equal fake_bin_paths.sort
77+
_(ports_bin_paths.sort).must_equal fake_bin_paths.sort
7878
end
7979

8080
it 'should return all the bin directories regardless of cwd' do
8181
Dir.chdir '/'
82-
ports_bin_paths.sort.must_equal fake_bin_paths.sort
82+
_(ports_bin_paths.sort).must_equal fake_bin_paths.sort
8383
end
8484
end
8585

@@ -89,19 +89,19 @@ class GemTest < MiniTest::Spec
8989
end
9090

9191
it 'should return no directories' do
92-
ports_bin_paths.must_be_empty
92+
_(ports_bin_paths).must_be_empty
9393
end
9494

9595
it 'should return no directories regardless of cwd' do
9696
Dir.chdir '/'
97-
ports_bin_paths.must_be_empty
97+
_(ports_bin_paths).must_be_empty
9898
end
9999
end
100100
end
101101

102102
describe '#ports_lib_paths' do
103103
let(:ports_lib_paths) { TinyTds::Gem.ports_lib_paths }
104-
104+
105105
describe 'when the ports directories exist' do
106106
let(:fake_lib_paths) do
107107
ports_host_root = File.join(gem_root, 'ports', 'fake-host-with-dirs')
@@ -128,12 +128,12 @@ class GemTest < MiniTest::Spec
128128
end
129129

130130
it 'should return all the lib directories' do
131-
ports_lib_paths.sort.must_equal fake_lib_paths.sort
131+
_(ports_lib_paths.sort).must_equal fake_lib_paths.sort
132132
end
133133

134134
it 'should return all the lib directories regardless of cwd' do
135135
Dir.chdir '/'
136-
ports_lib_paths.sort.must_equal fake_lib_paths.sort
136+
_(ports_lib_paths.sort).must_equal fake_lib_paths.sort
137137
end
138138
end
139139

@@ -144,12 +144,12 @@ class GemTest < MiniTest::Spec
144144

145145

146146
it 'should return no directories' do
147-
ports_lib_paths.must_be_empty
147+
_(ports_lib_paths).must_be_empty
148148
end
149149

150150
it 'should return no directories regardless of cwd' do
151151
Dir.chdir '/'
152-
ports_lib_paths.must_be_empty
152+
_(ports_lib_paths).must_be_empty
153153
end
154154
end
155155
end
@@ -169,7 +169,7 @@ class GemTest < MiniTest::Spec
169169
end
170170

171171
it "should return a #{expected} ports host" do
172-
TinyTds::Gem.ports_host.must_equal expected
172+
_(TinyTds::Gem.ports_host).must_equal expected
173173
end
174174
end
175175
end

0 commit comments

Comments
 (0)