Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
1d224982
Commit
1d224982
authored
Jan 15, 2019
by
Mark Lapierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Resource attribute bug
Allow Resources to have the same attribute name but different attribute values
parent
75b1837d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
11 deletions
+37
-11
qa/qa/resource/base.rb
qa/qa/resource/base.rb
+1
-11
qa/spec/resource/base_spec.rb
qa/spec/resource/base_spec.rb
+36
-0
No files found.
qa/qa/resource/base.rb
View file @
1d224982
...
...
@@ -116,23 +116,13 @@ module QA
end
private_class_method
:evaluator
def
self
.
dynamic_attributes
const_get
(
:DynamicAttributes
)
rescue
NameError
mod
=
const_set
(
:DynamicAttributes
,
Module
.
new
)
include
mod
mod
end
class
DSL
def
initialize
(
base
)
@base
=
base
end
def
attribute
(
name
,
&
block
)
@base
.
dynamic_attributes
.
module_eval
do
@base
.
module_eval
do
attr_writer
(
name
)
define_method
(
name
)
do
...
...
qa/spec/resource/base_spec.rb
View file @
1d224982
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment