Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lapierre <mlapierre@gitlab.com>2019-01-15 23:18:17 +0300
committerMark Lapierre <mlapierre@gitlab.com>2019-01-15 23:39:19 +0300
commit1d22498251fd728246611be7dd1a19adadbafae6 (patch)
tree4f830ee2ffb52a464638e7c812ea0cf8abbedcdd /qa/spec/resource
parent75b1837da79b5244a8da6bde1e391343fef59431 (diff)
Fix Resource attribute bug
Allow Resources to have the same attribute name but different attribute values
Diffstat (limited to 'qa/spec/resource')
-rw-r--r--qa/spec/resource/base_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb
index b8c406ae72a..a2a3ad01749 100644
--- a/qa/spec/resource/base_spec.rb
+++ b/qa/spec/resource/base_spec.rb
@@ -213,6 +213,42 @@ describe QA::Resource::Base do
.to raise_error(described_class::NoValueError, "No value was computed for no_block of #{resource.class.name}.")
end
end
+
+ context 'when multiple resources have the same attribute name' do
+ let(:base) do
+ Class.new(QA::Resource::Base) do
+ def fabricate!
+ 'any'
+ end
+
+ def self.current_url
+ 'http://stub'
+ end
+ end
+ end
+ let(:first_resource) do
+ Class.new(base) do
+ attribute :test do
+ 'first block'
+ end
+ end
+ end
+ let(:second_resource) do
+ Class.new(base) do
+ attribute :test do
+ 'second block'
+ end
+ end
+ end
+
+ it 'has unique attribute values' do
+ first_result = first_resource.fabricate!(resource: first_resource.new)
+ second_result = second_resource.fabricate!(resource: second_resource.new)
+
+ expect(first_result.test).to eq 'first block'
+ expect(second_result.test).to eq 'second block'
+ end
+ end
end
describe '#web_url' do