From 3d141d1512a39b61159026457b31c6f0aecf5b6c Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 20 Aug 2015 16:21:31 -0700 Subject: [PATCH] Fix spec by removing global state. --- lib/gitlab/reply_by_email.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/gitlab/reply_by_email.rb b/lib/gitlab/reply_by_email.rb index 4fdeb6b8a74..f93fda4302c 100644 --- a/lib/gitlab/reply_by_email.rb +++ b/lib/gitlab/reply_by_email.rb @@ -36,14 +36,12 @@ module Gitlab end def address_regex - @address_regex ||= begin - wildcard_address = config.address - return nil unless wildcard_address + wildcard_address = config.address + return nil unless wildcard_address - regex = Regexp.escape(wildcard_address) - regex = regex.gsub(Regexp.escape('%{reply_key}'), "(.+)") - Regexp.new(regex).freeze - end + regex = Regexp.escape(wildcard_address) + regex = regex.gsub(Regexp.escape('%{reply_key}'), "(.+)") + Regexp.new(regex).freeze end end end