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
82a49d0f
Commit
82a49d0f
authored
May 14, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clarify scope for AtomicInternalId shared spec
parent
1e76f289
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
9 additions
and
3 deletions
+9
-3
spec/models/ci/pipeline_spec.rb
spec/models/ci/pipeline_spec.rb
+1
-0
spec/models/deployment_spec.rb
spec/models/deployment_spec.rb
+1
-0
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+1
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+1
-0
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+2
-0
spec/support/shared_examples/models/atomic_internal_id_spec.rb
...support/shared_examples/models/atomic_internal_id_spec.rb
+3
-3
No files found.
spec/models/ci/pipeline_spec.rb
View file @
82a49d0f
...
@@ -39,6 +39,7 @@ describe Ci::Pipeline, :mailer do
...
@@ -39,6 +39,7 @@ describe Ci::Pipeline, :mailer do
it_behaves_like
'AtomicInternalId'
do
it_behaves_like
'AtomicInternalId'
do
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:instance
)
{
build
(
:ci_pipeline
)
}
let
(
:instance
)
{
build
(
:ci_pipeline
)
}
let
(
:scope
)
{
:project
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:usage
)
{
:ci_pipelines
}
let
(
:usage
)
{
:ci_pipelines
}
let
(
:allow_nil
)
{
true
}
let
(
:allow_nil
)
{
true
}
...
...
spec/models/deployment_spec.rb
View file @
82a49d0f
...
@@ -20,6 +20,7 @@ describe Deployment do
...
@@ -20,6 +20,7 @@ describe Deployment do
it_behaves_like
'AtomicInternalId'
do
it_behaves_like
'AtomicInternalId'
do
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:instance
)
{
build
(
:deployment
)
}
let
(
:instance
)
{
build
(
:deployment
)
}
let
(
:scope
)
{
:project
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:usage
)
{
:deployments
}
let
(
:usage
)
{
:deployments
}
end
end
...
...
spec/models/issue_spec.rb
View file @
82a49d0f
...
@@ -17,6 +17,7 @@ describe Issue do
...
@@ -17,6 +17,7 @@ describe Issue do
it_behaves_like
'AtomicInternalId'
do
it_behaves_like
'AtomicInternalId'
do
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:instance
)
{
build
(
:issue
)
}
let
(
:instance
)
{
build
(
:issue
)
}
let
(
:scope
)
{
:project
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:usage
)
{
:issues
}
let
(
:usage
)
{
:issues
}
end
end
...
...
spec/models/merge_request_spec.rb
View file @
82a49d0f
...
@@ -25,6 +25,7 @@ describe MergeRequest do
...
@@ -25,6 +25,7 @@ describe MergeRequest do
it_behaves_like
'AtomicInternalId'
do
it_behaves_like
'AtomicInternalId'
do
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:instance
)
{
build
(
:merge_request
)
}
let
(
:instance
)
{
build
(
:merge_request
)
}
let
(
:scope
)
{
:target_project
}
let
(
:scope_attrs
)
{
{
project:
instance
.
target_project
}
}
let
(
:scope_attrs
)
{
{
project:
instance
.
target_project
}
}
let
(
:usage
)
{
:merge_requests
}
let
(
:usage
)
{
:merge_requests
}
end
end
...
...
spec/models/milestone_spec.rb
View file @
82a49d0f
...
@@ -6,6 +6,7 @@ describe Milestone do
...
@@ -6,6 +6,7 @@ describe Milestone do
it_behaves_like
'AtomicInternalId'
do
it_behaves_like
'AtomicInternalId'
do
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:instance
)
{
build
(
:milestone
,
project:
build
(
:project
),
group:
nil
)
}
let
(
:instance
)
{
build
(
:milestone
,
project:
build
(
:project
),
group:
nil
)
}
let
(
:scope
)
{
:project
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:scope_attrs
)
{
{
project:
instance
.
project
}
}
let
(
:usage
)
{
:milestones
}
let
(
:usage
)
{
:milestones
}
end
end
...
@@ -15,6 +16,7 @@ describe Milestone do
...
@@ -15,6 +16,7 @@ describe Milestone do
it_behaves_like
'AtomicInternalId'
do
it_behaves_like
'AtomicInternalId'
do
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:internal_id_attribute
)
{
:iid
}
let
(
:instance
)
{
build
(
:milestone
,
project:
nil
,
group:
build
(
:group
))
}
let
(
:instance
)
{
build
(
:milestone
,
project:
nil
,
group:
build
(
:group
))
}
let
(
:scope
)
{
:group
}
let
(
:scope_attrs
)
{
{
namespace:
instance
.
group
}
}
let
(
:scope_attrs
)
{
{
namespace:
instance
.
group
}
}
let
(
:usage
)
{
:milestones
}
let
(
:usage
)
{
:milestones
}
end
end
...
...
spec/support/shared_examples/models/atomic_internal_id_spec.rb
View file @
82a49d0f
...
@@ -12,16 +12,16 @@ shared_examples_for 'AtomicInternalId' do
...
@@ -12,16 +12,16 @@ shared_examples_for 'AtomicInternalId' do
describe
'Validation'
do
describe
'Validation'
do
before
do
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:"ensure_
#{
scope
_attrs
.
keys
.
first
}
_
#{
internal_id_attribute
}
!"
)
{}
allow_any_instance_of
(
described_class
).
to
receive
(
:"ensure_
#{
scope
}
_
#{
internal_id_attribute
}
!"
)
{}
end
end
it
'validates presence'
do
it
'validates presence'
do
instance
.
valid?
instance
.
valid?
if
allow_nil
if
allow_nil
expect
(
instance
.
errors
[
:iid
]).
to
be_empty
expect
(
instance
.
errors
[
internal_id_attribute
]).
to
be_empty
else
else
expect
(
instance
.
errors
[
:iid
]).
to
include
(
"can't be blank"
)
expect
(
instance
.
errors
[
internal_id_attribute
]).
to
include
(
"can't be blank"
)
end
end
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