Skip to content

Commit c5fbfce

Browse files
SHinGo-Kobapirj
authored andcommitted
fixed Style/RaiseArgs
1 parent fdd186c commit c5fbfce

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

spec/rspec/rails/matchers/be_routable_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
end
1818

1919
it "fails if routes do not recognize the path" do
20-
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
20+
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError, 'ignore' }
2121
expect do
2222
expect({ get: "/a/path" }).to be_routable
2323
end.to raise_error(/expected \{:get=>"\/a\/path"\} to be routable/)
@@ -27,7 +27,7 @@
2727
context "with should_not" do
2828

2929
it "passes if routes do not recognize the path" do
30-
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError.new('ignore') }
30+
allow(routes).to receive(:recognize_path) { raise ActionController::RoutingError, 'ignore' }
3131
expect do
3232
expect({ get: "/a/path" }).not_to be_routable
3333
end.to_not raise_error

spec/rspec/rails/matchers/have_rendered_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def assert_template(*); end
4040
context "when assert_template fails" do
4141
it "uses failure message from assert_template" do
4242
def assert_template(*)
43-
raise ActiveSupport::TestCase::Assertion.new("this message")
43+
raise ActiveSupport::TestCase::Assertion, "this message"
4444
end
4545
expect do
4646
expect(response).to send(template_expectation, "template_name")
@@ -64,7 +64,7 @@ def assert_template(*)
6464
context "when assert_template fails" do
6565
it "passes" do
6666
def assert_template(*)
67-
raise ActiveSupport::TestCase::Assertion.new("this message")
67+
raise ActiveSupport::TestCase::Assertion, "this message"
6868
end
6969
expect do
7070
expect(response).to_not send(template_expectation, "template_name")
@@ -77,7 +77,7 @@ def assert_template(*)
7777
def assert_template(*); end
7878
expect do
7979
expect(response).to_not send(template_expectation, "template_name")
80-
end.to raise_error(/expected not to render \"template_name\", but did/)
80+
end.to raise_error(/expected not to render "template_name", but did/)
8181
end
8282
end
8383

@@ -95,7 +95,7 @@ def assert_template(*); raise "oops"; end
9595

9696
def assert_template(*)
9797
message = "expecting <'template_name'> but rendering with <[]>"
98-
raise ActiveSupport::TestCase::Assertion.new(message)
98+
raise ActiveSupport::TestCase::Assertion, message
9999
end
100100

101101
def normalize_argument_to_redirection(_response_redirect_location)
@@ -113,7 +113,7 @@ def normalize_argument_to_redirection(_response_redirect_location)
113113
context 'with a badly formatted error message' do
114114
def assert_template(*)
115115
message = 'expected [] to include "some/path"'
116-
raise ActiveSupport::TestCase::Assertion.new(message)
116+
raise ActiveSupport::TestCase::Assertion, message
117117
end
118118

119119
it 'falls back to something informative' do

spec/rspec/rails/matchers/redirect_to_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def assert_redirected_to(*); end
1919

2020
context "when assert_redirected_to fails" do
2121
def assert_redirected_to(*)
22-
raise ActiveSupport::TestCase::Assertion.new("this message")
22+
raise ActiveSupport::TestCase::Assertion, "this message"
2323
end
2424

2525
it "uses failure message from assert_redirected_to" do
@@ -45,7 +45,7 @@ def assert_redirected_to(*)
4545
context "with should_not" do
4646
context "when assert_redirected_to fails" do
4747
def assert_redirected_to(*)
48-
raise ActiveSupport::TestCase::Assertion.new("this message")
48+
raise ActiveSupport::TestCase::Assertion, "this message"
4949
end
5050

5151
it "passes" do
@@ -61,7 +61,7 @@ def assert_redirected_to(*); end
6161
it "fails with custom failure message" do
6262
expect do
6363
expect(response).not_to redirect_to("destination")
64-
end.to raise_exception(/expected not to redirect to \"destination\", but did/)
64+
end.to raise_exception(/expected not to redirect to "destination", but did/)
6565
end
6666
end
6767

spec/rspec/rails/matchers/route_to_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def assert_recognizes(*)
7373
context "when assert_recognizes fails with an assertion failure" do
7474
it "fails with message from assert_recognizes" do
7575
def assert_recognizes(*)
76-
raise ActiveSupport::TestCase::Assertion.new("this message")
76+
raise ActiveSupport::TestCase::Assertion, "this message"
7777
end
7878
expect do
7979
expect({ get: "path" }).to route_to("these" => "options")
@@ -84,7 +84,7 @@ def assert_recognizes(*)
8484
context "when assert_recognizes fails with a routing error" do
8585
it "fails with message from assert_recognizes" do
8686
def assert_recognizes(*)
87-
raise ActionController::RoutingError.new("this message")
87+
raise ActionController::RoutingError, "this message"
8888
end
8989
expect do
9090
expect({ get: "path" }).to route_to("these" => "options")
@@ -116,7 +116,7 @@ def assert_recognizes(*)
116116
context "when assert_recognizes fails with an assertion failure" do
117117
it "passes" do
118118
def assert_recognizes(*)
119-
raise ActiveSupport::TestCase::Assertion.new("this message")
119+
raise ActiveSupport::TestCase::Assertion, "this message"
120120
end
121121
expect do
122122
expect({ get: "path" }).not_to route_to("these" => "options")
@@ -127,7 +127,7 @@ def assert_recognizes(*)
127127
context "when assert_recognizes fails with a routing error" do
128128
it "passes" do
129129
def assert_recognizes(*)
130-
raise ActionController::RoutingError.new("this message")
130+
raise ActionController::RoutingError, "this message"
131131
end
132132
expect do
133133
expect({ get: "path" }).not_to route_to("these" => "options")

0 commit comments

Comments
 (0)