diff --git a/spec/requests/admin/reactions_spec.rb b/spec/requests/admin/reactions_spec.rb index d278e1172..43b157238 100644 --- a/spec/requests/admin/reactions_spec.rb +++ b/spec/requests/admin/reactions_spec.rb @@ -62,7 +62,7 @@ RSpec.describe "/admin/reactions", type: :request do put admin_reaction_path(reaction.id), params: { id: reaction.id, status: "confirmed" } end - expect(invalid_request).to raise_error(Pundit::NotAuthorizedError) + expect { invalid_request.call }.to raise_error(Pundit::NotAuthorizedError) end end end diff --git a/spec/services/analytics_service_spec.rb b/spec/services/analytics_service_spec.rb index c703eb023..a99aaae43 100644 --- a/spec/services/analytics_service_spec.rb +++ b/spec/services/analytics_service_spec.rb @@ -27,17 +27,17 @@ RSpec.describe AnalyticsService, type: :service do describe "initialization" do it "raises an error if start date is invalid" do - expect(-> { described_class.new(user, start_date: "2000-") }).to raise_error(ArgumentError) + expect { described_class.new(user, start_date: "2000-") }.to raise_error(ArgumentError) end it "raises an error if end date is invalid" do - expect(-> { described_class.new(user, end_date: "2000-") }).to raise_error(ArgumentError) + expect { described_class.new(user, end_date: "2000-") }.to raise_error(ArgumentError) end it "raises an error if an article does not belong to the user" do other_user = create(:user) article = create(:article, user: other_user) - expect(-> { described_class.new(user, article_id: article.id) }).to raise_error(ArgumentError) + expect { described_class.new(user, article_id: article.id) }.to raise_error(ArgumentError) end end