Skip to content

Commit c118003

Browse files
committed
Avoid triggering ambigous slash warnings
Ignoring those warnings is not working on `rake test` anyway.
1 parent 55a66f5 commit c118003

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

test/integration/instrumentation_test.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ class InstrumentationTest < IntegrationTest
66
visit "/login"
77
end
88

9-
assert_match /Processing by RodauthController#login as HTML/, logged
10-
refute_match /Parameters/, logged
9+
assert_match(/Processing by RodauthController#login as HTML/, logged)
10+
refute_match(/Parameters/, logged)
1111
if ::Rails.gem_version >= Gem::Version.new("6.0")
12-
assert_match /Completed 200 OK in \d+ms \(Views: \d+ms | ActiveRecord: \d+\.\d+ms | Allocations: \d+\)/, logged
12+
assert_match(/Completed 200 OK in \d+ms \(Views: \d+ms | ActiveRecord: \d+\.\d+ms | Allocations: \d+\)/, logged)
1313
else
14-
assert_match /Completed 200 OK in \d+ms \(Views: \d+ms | ActiveRecord: \d+\.\d+ms\)/, logged
14+
assert_match(/Completed 200 OK in \d+ms \(Views: \d+ms | ActiveRecord: \d+\.\d+ms\)/, logged)
1515
end
1616
end
1717

@@ -22,44 +22,44 @@ class InstrumentationTest < IntegrationTest
2222
{ "CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json" }
2323
end
2424

25-
assert_match /Processing by ActionController::API#login as JSON/, logged
26-
assert_match /Parameters: {"login"=>"user@example\.com", "password"=>"secret"}/, logged
27-
assert_match /Completed 401 Unauthorized/, logged
25+
assert_match(/Processing by ActionController::API#login as JSON/, logged)
26+
assert_match(/Parameters: {"login" ?=> ?"user@example\.com", "password" ?=> ?"secret"}/, logged)
27+
assert_match(/Completed 401 Unauthorized/, logged)
2828
end
2929

3030
test "logs redirects" do
3131
logged = capture_log do
3232
visit "/change-password"
3333
end
3434

35-
assert_match /Processing by RodauthController#change_password as HTML/, logged
36-
assert_match /Redirected to \/login/, logged
37-
assert_match /Completed 302 Found/, logged
35+
assert_match(/Processing by RodauthController#change_password as HTML/, logged)
36+
assert_match(/Redirected to \/login/, logged)
37+
assert_match(/Completed 302 Found/, logged)
3838
end
3939

4040
test "handles early response via callback" do
4141
logged = capture_log do
4242
visit "/login?early_return=true"
4343
end
4444

45-
assert_match /Processing by RodauthController#login as HTML/, logged
46-
assert_match /Completed 201 Created in \d+ms/, logged
45+
assert_match(/Processing by RodauthController#login as HTML/, logged)
46+
assert_match(/Completed 201 Created in \d+ms/, logged)
4747
end
4848

4949
test "logs response status when redirecting inside controller" do
5050
logged = capture_log do
5151
visit "/auth2"
5252
end
5353

54-
assert_match /Completed 302 Found/, logged
54+
assert_match(/Completed 302 Found/, logged)
5555
end
5656

5757
test "logs response status when halting inside controller" do
5858
logged = capture_log do
5959
visit "/auth_json"
6060
end
6161

62-
assert_match /Completed 401 Unauthorized/, logged
62+
assert_match(/Completed 401 Unauthorized/, logged)
6363
end
6464

6565
private

test/test_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ENV["RAILS_ENV"] = "test"
22

33
require "warning"
4-
Warning.ignore(:ambiguous_slash, __dir__)
54
Gem.path.each { |path| Warning.ignore(//, path) } # ignore warnings in dependencies
65

76
require "bundler/setup"

0 commit comments

Comments
 (0)