Don't use "not_to raise_error" with specific class (#10602)

This commit is contained in:
Michael Kohl 2020-10-05 22:29:01 +07:00 committed by GitHub
parent 18672f24f0
commit 640f124033
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 13 deletions

View file

@ -189,7 +189,7 @@ RSpec.describe MarkdownParser, type: :labor do
it "does not raise error if no XSS attempt detected" do
expect do
generate_and_parse_markdown("```const data = 'data:text/html';```")
end.not_to raise_error(ArgumentError)
end.not_to raise_error
end
end

View file

@ -70,7 +70,7 @@ RSpec.describe LinkTag, type: :liquid_tag do
it "does not raise an error when invalid" do
expect { generate_new_liquid(slug: "fake_username/fake_article_slug") }
.not_to raise_error("Invalid link URL or link URL does not exist")
.not_to raise_error
end
it "renders a proper link tag" do

View file

@ -21,7 +21,7 @@ RSpec.describe LiquidTagBase, type: :liquid_tag do
expect do
liquid_tag_options = { source: source, user: source.user }
Liquid::Template.parse("{% liquid_tag_base %}", liquid_tag_options)
end.not_to raise_error(LiquidTags::Errors::InvalidParseContext)
end.not_to raise_error
end
end
@ -31,7 +31,7 @@ RSpec.describe LiquidTagBase, type: :liquid_tag do
liquid_tag_options = { source: source, user: source.user }
expect do
Liquid::Template.parse("{% liquid_tag_base %}", liquid_tag_options)
end.not_to raise_error(LiquidTags::Errors::InvalidParseContext)
end.not_to raise_error
end
end
@ -52,7 +52,7 @@ RSpec.describe LiquidTagBase, type: :liquid_tag do
stub_const("#{described_class}::VALID_ROLES", %i[admin])
expect do
Liquid::Template.parse("{% liquid_tag_base %}", liquid_tag_options)
end.not_to raise_error(Pundit::NotAuthorizedError)
end.not_to raise_error
end
it "validates single resource roles" do
@ -63,7 +63,7 @@ RSpec.describe LiquidTagBase, type: :liquid_tag do
stub_const("#{described_class}::VALID_ROLES", [[:single_resource_admin, Article]])
expect do
Liquid::Template.parse("{% liquid_tag_base %}", liquid_tag_options)
end.not_to raise_error(Pundit::NotAuthorizedError)
end.not_to raise_error
end
end
@ -73,7 +73,7 @@ RSpec.describe LiquidTagBase, type: :liquid_tag do
liquid_tag_options = { source: source, user: source.user }
expect do
Liquid::Template.parse("{% liquid_tag_base %}", liquid_tag_options)
end.not_to raise_error(Pundit::NotAuthorizedError)
end.not_to raise_error
end
end
end

View file

@ -18,11 +18,11 @@ RSpec.describe Github::OauthClient, type: :service, vcr: true do
end
it "succeeds if access_token is present" do
expect { described_class.new(access_token: "value") }.not_to raise_error(ArgumentError)
expect { described_class.new(access_token: "value") }.not_to raise_error
end
it "succeeds if both client_id and client_secret are present" do
expect { described_class.new(client_id: "value", client_secret: "value") }.not_to raise_error(ArgumentError)
expect { described_class.new(client_id: "value", client_secret: "value") }.not_to raise_error
end
end

View file

@ -14,6 +14,6 @@ RSpec.describe Search::IndexWorker, type: :worker, elasticsearch: "Tag" do
end
it "does not raise an error if record is not found" do
expect { worker.perform("Tag", 1234) }.not_to raise_error(ActiveRecord::RecordNotFound)
expect { worker.perform("Tag", 1234) }.not_to raise_error
end
end

View file

@ -14,9 +14,7 @@ RSpec.describe Search::RemoveFromIndexWorker, type: :worker do
context "when document is not found" do
it "does not raise error" do
expect { described_class.new.perform(search_class.to_s, 1) }.not_to raise_error(
Search::Errors::Transport::NotFound,
)
expect { described_class.new.perform(search_class.to_s, 1) }.not_to raise_error
end
end
end