From 37e5ee858f51a38dbae6910989091d15eee784be Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 29 Aug 2017 08:26:48 +0800 Subject: [PATCH] REFACTOR: Just pass a block instead of using a lambda. --- spec/components/topic_creator_spec.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/components/topic_creator_spec.rb b/spec/components/topic_creator_spec.rb index ade3f596042..712d7718860 100644 --- a/spec/components/topic_creator_spec.rb +++ b/spec/components/topic_creator_spec.rb @@ -83,12 +83,18 @@ describe TopicCreator do context 'failure cases' do it "min_trust_to_send_messages setting should be checked when sending private message" do SiteSetting.min_trust_to_send_messages = TrustLevel[4] - expect(-> { TopicCreator.create(user, Guardian.new(user), pm_valid_attrs) }).to raise_error(ActiveRecord::Rollback) + + expect do + TopicCreator.create(user, Guardian.new(user), pm_valid_attrs) + end.to raise_error(ActiveRecord::Rollback) end it "min_trust_to_send_email_messages should be checked when sending private messages via email" do SiteSetting.min_trust_to_send_email_messages = TrustLevel[4] - expect(-> { TopicCreator.create(user, Guardian.new(user), pm_to_email_valid_attrs) }).to raise_error(ActiveRecord::Rollback) + + expect do + TopicCreator.create(user, Guardian.new(user), pm_to_email_valid_attrs) + end.to raise_error(ActiveRecord::Rollback) end end end