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
Boxiang Sun
gitlab-ce
Commits
1011ca49
Commit
1011ca49
authored
Jan 11, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a DSL evaluator to QA base factory class
parent
2de8fb7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
qa/qa/factory/base.rb
qa/qa/factory/base.rb
+22
-7
No files found.
qa/qa/factory/base.rb
View file @
1011ca49
require
'forwardable'
module
QA
module
Factory
class
Base
extend
SingleForwardable
def_delegators
:evaluator
,
:dependency
,
:dependencies
def
fabricate!
(
*
_args
)
raise
NotImplementedError
end
...
...
@@ -17,16 +23,25 @@ module QA
end
end
def
self
.
dependencies
@
dependencies
||=
{}
def
self
.
evaluator
@
evaluator
||=
Factory
::
Base
::
DSL
.
new
(
self
)
end
def
self
.
dependency
(
factory
,
as
:,
&
block
)
as
.
tap
do
|
name
|
class_eval
{
attr_accessor
name
}
class
DSL
attr_reader
:dependencies
def
initialize
(
base
)
@base
=
base
@dependencies
=
{}
end
def
dependency
(
factory
,
as
:,
&
block
)
as
.
tap
do
|
name
|
@base
.
class_eval
{
attr_accessor
name
}
Dependency
::
Signature
.
new
(
factory
,
block
).
tap
do
|
signature
|
dependencies
.
store
(
name
,
signature
)
Dependency
::
Signature
.
new
(
factory
,
block
).
tap
do
|
signature
|
dependencies
.
store
(
name
,
signature
)
end
end
end
end
...
...
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