Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7c9355

Browse files
committed
Use assert_path_exist and assert_path_not_exist instead of assert_path_exists and refute_path_exists
1 parent f675944 commit a7c9355

36 files changed

+302
-302
lines changed

lib/rubygems/test_case.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def assert_activate(expected, *specs)
141141

142142
def assert_directory_exists(path, msg = nil)
143143
msg = build_message(msg, "Expected path '#{path}' to be a directory")
144-
assert_path_exists path
144+
assert_path_exist path
145145
assert File.directory?(path), msg
146146
end
147147

test/rubygems/test_gem.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_self_install
106106

107107
assert_equal %w[a-1], installed.map {|spec| spec.full_name }
108108

109-
assert_path_exists File.join(gemhome2, 'gems', 'a-1')
109+
assert_path_exist File.join(gemhome2, 'gems', 'a-1')
110110
end
111111

112112
def test_self_install_in_rescue
@@ -692,12 +692,12 @@ def test_self_ensure_gem_directories
692692

693693
Gem.ensure_gem_subdirectories @gemhome
694694

695-
assert_path_exists File.join @gemhome, 'build_info'
696-
assert_path_exists File.join @gemhome, 'cache'
697-
assert_path_exists File.join @gemhome, 'doc'
698-
assert_path_exists File.join @gemhome, 'extensions'
699-
assert_path_exists File.join @gemhome, 'gems'
700-
assert_path_exists File.join @gemhome, 'specifications'
695+
assert_path_exist File.join @gemhome, 'build_info'
696+
assert_path_exist File.join @gemhome, 'cache'
697+
assert_path_exist File.join @gemhome, 'doc'
698+
assert_path_exist File.join @gemhome, 'extensions'
699+
assert_path_exist File.join @gemhome, 'gems'
700+
assert_path_exist File.join @gemhome, 'specifications'
701701
end
702702

703703
def test_self_ensure_gem_directories_permissions

test/rubygems/test_gem_commands_cert_command.rb

+22-22
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_execute_add
8383

8484
cert_path = @trust_dir.cert_path PUBLIC_CERT
8585

86-
assert_path_exists cert_path
86+
assert_path_exist cert_path
8787

8888
assert_equal "Added '/CN=nobody/DC=example'\n", @ui.output
8989
assert_empty @ui.error
@@ -138,8 +138,8 @@ def test_execute_build
138138
assert_empty output
139139
assert_empty @build_ui.error
140140

141-
assert_path_exists File.join(@tempdir, 'gem-private_key.pem')
142-
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
141+
assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
142+
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
143143
end
144144

145145
def test_execute_build_bad_email_address
@@ -159,8 +159,8 @@ def test_execute_build_bad_email_address
159159
assert_equal "Invalid email address #{email}",
160160
e.message
161161

162-
refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
163-
refute_path_exists File.join(@tempdir, 'gem-public_cert.pem')
162+
assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
163+
assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
164164
end
165165
end
166166

@@ -195,8 +195,8 @@ def test_execute_build_expiration_days
195195
assert_empty output
196196
assert_empty @build_ui.error
197197

198-
assert_path_exists File.join(@tempdir, 'gem-private_key.pem')
199-
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
198+
assert_path_exist File.join(@tempdir, 'gem-private_key.pem')
199+
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
200200

201201
pem = File.read("#{@tempdir}/gem-public_cert.pem")
202202
cert = OpenSSL::X509::Certificate.new(pem)
@@ -232,8 +232,8 @@ def test_execute_build_bad_passphrase_confirmation
232232

233233
end
234234

235-
refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
236-
refute_path_exists File.join(@tempdir, 'gem-public_cert.pem')
235+
assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
236+
assert_path_not_exist File.join(@tempdir, 'gem-public_cert.pem')
237237
end
238238

239239
def test_execute_build_key
@@ -254,8 +254,8 @@ def test_execute_build_key
254254
assert_empty output
255255
assert_empty @ui.error
256256

257-
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
258-
refute_path_exists File.join(@tempdir, 'gem-private_key.pem')
257+
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
258+
assert_path_not_exist File.join(@tempdir, 'gem-private_key.pem')
259259
end
260260

261261
def test_execute_build_encrypted_key
@@ -276,7 +276,7 @@ def test_execute_build_encrypted_key
276276
assert_empty output
277277
assert_empty @ui.error
278278

279-
assert_path_exists File.join(@tempdir, 'gem-public_cert.pem')
279+
assert_path_exist File.join(@tempdir, 'gem-public_cert.pem')
280280
end
281281

282282
def test_execute_certificate
@@ -346,7 +346,7 @@ def test_execute_remove
346346

347347
cert_path = @trust_dir.cert_path PUBLIC_CERT
348348

349-
assert_path_exists cert_path
349+
assert_path_exist cert_path
350350

351351
@cmd.handle_options %W[--remove nobody]
352352

@@ -357,7 +357,7 @@ def test_execute_remove
357357
assert_equal "Removed '/CN=nobody/DC=example'\n", @ui.output
358358
assert_equal '', @ui.error
359359

360-
refute_path_exists cert_path
360+
assert_path_not_exist cert_path
361361
end
362362

363363
def test_execute_remove_multiple
@@ -367,8 +367,8 @@ def test_execute_remove_multiple
367367
public_path = @trust_dir.cert_path PUBLIC_CERT
368368
alternate_path = @trust_dir.cert_path ALTERNATE_CERT
369369

370-
assert_path_exists public_path
371-
assert_path_exists alternate_path
370+
assert_path_exist public_path
371+
assert_path_exist alternate_path
372372

373373
@cmd.handle_options %W[--remove example]
374374

@@ -384,8 +384,8 @@ def test_execute_remove_multiple
384384
assert_equal expected, @ui.output
385385
assert_equal '', @ui.error
386386

387-
refute_path_exists public_path
388-
refute_path_exists alternate_path
387+
assert_path_not_exist public_path
388+
assert_path_not_exist alternate_path
389389
end
390390

391391
def test_execute_remove_twice
@@ -395,8 +395,8 @@ def test_execute_remove_twice
395395
public_path = @trust_dir.cert_path PUBLIC_CERT
396396
alternate_path = @trust_dir.cert_path ALTERNATE_CERT
397397

398-
assert_path_exists public_path
399-
assert_path_exists alternate_path
398+
assert_path_exist public_path
399+
assert_path_exist alternate_path
400400

401401
@cmd.handle_options %W[--remove nobody --remove alternate]
402402

@@ -412,8 +412,8 @@ def test_execute_remove_twice
412412
assert_equal expected, @ui.output
413413
assert_equal '', @ui.error
414414

415-
refute_path_exists public_path
416-
refute_path_exists alternate_path
415+
assert_path_not_exist public_path
416+
assert_path_not_exist alternate_path
417417
end
418418

419419
def test_execute_sign

test/rubygems/test_gem_commands_check_command.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def test_doctor
5050

5151
FileUtils.rm b.spec_file
5252

53-
assert_path_exists b.gem_dir
54-
refute_path_exists b.spec_file
53+
assert_path_exist b.gem_dir
54+
assert_path_not_exist b.spec_file
5555

5656
Gem.use_paths @gemhome
5757

@@ -61,7 +61,7 @@ def test_doctor
6161
end
6262
end
6363

64-
refute_path_exists b.gem_dir
65-
refute_path_exists b.spec_file
64+
assert_path_not_exist b.gem_dir
65+
assert_path_not_exist b.spec_file
6666
end
6767
end

test/rubygems/test_gem_commands_cleanup_command.rb

+24-24
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def test_execute
6262

6363
@cmd.execute
6464

65-
refute_path_exists @a_1.gem_dir
65+
assert_path_not_exist @a_1.gem_dir
6666
end
6767

6868
def test_execute_all_dependencies
@@ -81,8 +81,8 @@ def test_execute_all_dependencies
8181

8282
@cmd.execute
8383

84-
refute_path_exists @a_1.gem_dir
85-
refute_path_exists @b_1.gem_dir
84+
assert_path_not_exist @a_1.gem_dir
85+
assert_path_not_exist @b_1.gem_dir
8686
end
8787

8888
def test_execute_dev_dependencies
@@ -101,7 +101,7 @@ def test_execute_dev_dependencies
101101

102102
@cmd.execute
103103

104-
assert_path_exists @a_1.gem_dir
104+
assert_path_exist @a_1.gem_dir
105105
end
106106

107107
def test_execute_without_dev_dependencies
@@ -120,7 +120,7 @@ def test_execute_without_dev_dependencies
120120

121121
@cmd.execute
122122

123-
refute_path_exists @a_1.gem_dir
123+
assert_path_not_exist @a_1.gem_dir
124124
end
125125

126126
def test_execute_all
@@ -143,8 +143,8 @@ def test_execute_all
143143
assert_equal @gemhome, Gem.dir, 'GEM_HOME'
144144
assert_equal [@gemhome, gemhome2], Gem.path.sort, 'GEM_PATH'
145145

146-
refute_path_exists @a_1.gem_dir
147-
refute_path_exists @b_1.gem_dir
146+
assert_path_not_exist @a_1.gem_dir
147+
assert_path_not_exist @b_1.gem_dir
148148
end
149149

150150
def test_execute_all_user
@@ -153,15 +153,15 @@ def test_execute_all_user
153153

154154
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
155155

156-
assert_path_exists @a_1.gem_dir
157-
assert_path_exists @a_1_1.gem_dir
156+
assert_path_exist @a_1.gem_dir
157+
assert_path_exist @a_1_1.gem_dir
158158

159159
@cmd.options[:args] = %w[a]
160160

161161
@cmd.execute
162162

163-
refute_path_exists @a_1.gem_dir
164-
refute_path_exists @a_1_1.gem_dir
163+
assert_path_not_exist @a_1.gem_dir
164+
assert_path_not_exist @a_1_1.gem_dir
165165
end
166166

167167
def test_execute_all_user_no_sudo
@@ -172,15 +172,15 @@ def test_execute_all_user_no_sudo
172172

173173
Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
174174

175-
assert_path_exists @a_1.gem_dir
176-
assert_path_exists @a_1_1.gem_dir
175+
assert_path_exist @a_1.gem_dir
176+
assert_path_exist @a_1_1.gem_dir
177177

178178
@cmd.options[:args] = %w[a]
179179

180180
@cmd.execute
181181

182-
assert_path_exists @a_1.gem_dir
183-
assert_path_exists @a_1_1.gem_dir
182+
assert_path_exist @a_1.gem_dir
183+
assert_path_exist @a_1_1.gem_dir
184184
ensure
185185
FileUtils.chmod 0755, @gemhome
186186
end unless win_platform? || Process.uid.zero?
@@ -191,7 +191,7 @@ def test_execute_dry_run
191191

192192
@cmd.execute
193193

194-
assert_path_exists @a_1.gem_dir
194+
assert_path_exist @a_1.gem_dir
195195
end
196196

197197
def test_execute_keeps_older_versions_with_deps
@@ -210,7 +210,7 @@ def test_execute_keeps_older_versions_with_deps
210210

211211
@cmd.execute
212212

213-
assert_path_exists @b_1.gem_dir
213+
assert_path_exist @b_1.gem_dir
214214
end
215215

216216
def test_execute_ignore_default_gem_verbose
@@ -257,9 +257,9 @@ def test_execute_remove_gem_home_only
257257

258258
@cmd.execute
259259

260-
assert_path_exists c_1.gem_dir
261-
refute_path_exists d_1.gem_dir
262-
refute_path_exists e_1.gem_dir
260+
assert_path_exist c_1.gem_dir
261+
assert_path_not_exist d_1.gem_dir
262+
assert_path_not_exist e_1.gem_dir
263263
end
264264

265265
def test_execute_user_install
@@ -282,10 +282,10 @@ def test_execute_user_install
282282

283283
@cmd.execute
284284

285-
refute_path_exists c_1.gem_dir
286-
assert_path_exists c_2.gem_dir
285+
assert_path_not_exist c_1.gem_dir
286+
assert_path_exist c_2.gem_dir
287287

288-
assert_path_exists d_1.gem_dir
289-
assert_path_exists d_2.gem_dir
288+
assert_path_exist d_1.gem_dir
289+
assert_path_exist d_2.gem_dir
290290
end
291291
end

test/rubygems/test_gem_commands_fetch_command.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_execute
1616
fetcher.gem 'a', 2
1717
end
1818

19-
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
19+
assert_path_not_exist File.join(@tempdir, 'cache'), 'sanity check'
2020

2121
@cmd.options[:args] = %w[a]
2222

@@ -28,9 +28,9 @@ def test_execute
2828

2929
a2 = specs['a-2']
3030

31-
assert_path_exists(File.join(@tempdir, a2.file_name),
31+
assert_path_exist(File.join(@tempdir, a2.file_name),
3232
"#{a2.full_name} not fetched")
33-
refute_path_exists File.join(@tempdir, 'cache'),
33+
assert_path_not_exist File.join(@tempdir, 'cache'),
3434
'gem repository directories must not be created'
3535
end
3636

@@ -40,7 +40,7 @@ def test_execute_latest
4040
fetcher.gem 'a', 2
4141
end
4242

43-
refute_path_exists File.join(@tempdir, 'cache'), 'sanity check'
43+
assert_path_not_exist File.join(@tempdir, 'cache'), 'sanity check'
4444

4545
@cmd.options[:args] = %w[a]
4646
@cmd.options[:version] = req('>= 0.1')
@@ -52,9 +52,9 @@ def test_execute_latest
5252
end
5353

5454
a2 = specs['a-2']
55-
assert_path_exists(File.join(@tempdir, a2.file_name),
55+
assert_path_exist(File.join(@tempdir, a2.file_name),
5656
"#{a2.full_name} not fetched")
57-
refute_path_exists File.join(@tempdir, 'cache'),
57+
assert_path_not_exist File.join(@tempdir, 'cache'),
5858
'gem repository directories must not be created'
5959
end
6060

@@ -75,7 +75,7 @@ def test_execute_prerelease
7575

7676
a2 = specs['a-2']
7777

78-
assert_path_exists(File.join(@tempdir, a2.file_name),
78+
assert_path_exist(File.join(@tempdir, a2.file_name),
7979
"#{a2.full_name} not fetched")
8080
end
8181

@@ -97,7 +97,7 @@ def test_execute_specific_prerelease
9797

9898
a2_pre = specs['a-2.a']
9999

100-
assert_path_exists(File.join(@tempdir, a2_pre.file_name),
100+
assert_path_exist(File.join(@tempdir, a2_pre.file_name),
101101
"#{a2_pre.full_name} not fetched")
102102
end
103103

@@ -118,7 +118,7 @@ def test_execute_version
118118

119119
a1 = specs['a-1']
120120

121-
assert_path_exists(File.join(@tempdir, a1.file_name),
121+
assert_path_exist(File.join(@tempdir, a1.file_name),
122122
"#{a1.full_name} not fetched")
123123
end
124124
end

0 commit comments

Comments
 (0)