summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-12-15 19:56:15 +0000
committerRobert Speicher <robert@gitlab.com>2017-12-15 19:56:15 +0000
commitb540b987648ae6e24bbbc01a7773b2e3209a47b0 (patch)
tree904ace3d5524eef227976910e136f98925e62371 /qa
parent95f5a525b5a729725d6b559101026b8f39c9c39d (diff)
parent02994fbe7715ef4539f720b6d395eeb9a3d71f14 (diff)
downloadgitlab-ce-b540b987648ae6e24bbbc01a7773b2e3209a47b0.tar.gz
Merge branch 'no-ivar-in-modules' into 'master'
Add cop to make sure we don't use ivar in a module See merge request gitlab-org/gitlab-ce!12800
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/runtime/scenario.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/qa/qa/runtime/scenario.rb b/qa/qa/runtime/scenario.rb
index 7ef59046640..15d4112d347 100644
--- a/qa/qa/runtime/scenario.rb
+++ b/qa/qa/runtime/scenario.rb
@@ -6,13 +6,15 @@ module QA
module Scenario
extend self
- attr_reader :attributes
+ def attributes
+ @attributes ||= {}
+ end
def define(attribute, value)
- (@attributes ||= {}).store(attribute.to_sym, value)
+ attributes.store(attribute.to_sym, value)
define_singleton_method(attribute) do
- @attributes[attribute.to_sym].tap do |value|
+ attributes[attribute.to_sym].tap do |value|
if value.to_s.empty?
raise ArgumentError, "Empty `#{attribute}` attribute!"
end