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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
dee52393
Commit
dee52393
authored
Apr 16, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct usage of `subject` in specs
parent
2dace367
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
7 deletions
+11
-7
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+2
-1
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+2
-1
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+3
-2
spec/models/note_spec.rb
spec/models/note_spec.rb
+2
-1
spec/support/mentionable_shared_examples.rb
spec/support/mentionable_shared_examples.rb
+1
-1
spec/support/taskable_shared_examples.rb
spec/support/taskable_shared_examples.rb
+1
-1
No files found.
spec/models/commit_spec.rb
View file @
dee52393
...
@@ -69,8 +69,9 @@ eos
...
@@ -69,8 +69,9 @@ eos
end
end
it_behaves_like
'a mentionable'
do
it_behaves_like
'a mentionable'
do
let
(
:subject
)
{
commit
}
let
(
:mauthor
)
{
create
:user
,
email:
commit
.
author_email
}
let
(
:mauthor
)
{
create
:user
,
email:
commit
.
author_email
}
subject
{
commit
}
let
(
:backref_text
)
{
"commit
#{
subject
.
id
}
"
}
let
(
:backref_text
)
{
"commit
#{
subject
.
id
}
"
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
stub
(
safe_message:
txt
)
}
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
stub
(
safe_message:
txt
)
}
}
...
...
spec/models/issue_spec.rb
View file @
dee52393
...
@@ -56,7 +56,8 @@ describe Issue do
...
@@ -56,7 +56,8 @@ describe Issue do
end
end
it_behaves_like
'an editable mentionable'
do
it_behaves_like
'an editable mentionable'
do
let
(
:subject
)
{
create
:issue
,
project:
mproject
}
subject
{
create
(
:issue
,
project:
project
)
}
let
(
:backref_text
)
{
"issue #
#{
subject
.
iid
}
"
}
let
(
:backref_text
)
{
"issue #
#{
subject
.
iid
}
"
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
description
=
txt
}
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
description
=
txt
}
}
end
end
...
...
spec/models/merge_request_spec.rb
View file @
dee52393
...
@@ -116,12 +116,13 @@ describe MergeRequest do
...
@@ -116,12 +116,13 @@ describe MergeRequest do
end
end
it_behaves_like
'an editable mentionable'
do
it_behaves_like
'an editable mentionable'
do
let
(
:subject
)
{
create
:merge_request
,
source_project:
mproject
,
target_project:
mproject
}
subject
{
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
}
let
(
:backref_text
)
{
"merge request !
#{
subject
.
iid
}
"
}
let
(
:backref_text
)
{
"merge request !
#{
subject
.
iid
}
"
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
title
=
txt
}
}
let
(
:set_mentionable_text
)
{
->
(
txt
){
subject
.
title
=
txt
}
}
end
end
it_behaves_like
'a Taskable'
do
it_behaves_like
'a Taskable'
do
let
(
:subject
)
{
create
:merge_request
,
:simple
}
subject
{
create
:merge_request
,
:simple
}
end
end
end
end
spec/models/note_spec.rb
View file @
dee52393
...
@@ -629,8 +629,9 @@ describe Note do
...
@@ -629,8 +629,9 @@ describe Note do
end
end
it_behaves_like
'an editable mentionable'
do
it_behaves_like
'an editable mentionable'
do
subject
{
create
:note
,
noteable:
issue
,
project:
project
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:issue
)
{
create
:issue
,
project:
project
}
let
(
:subject
)
{
create
:note
,
noteable:
issue
,
project:
project
}
let
(
:backref_text
)
{
issue
.
gfm_reference
}
let
(
:backref_text
)
{
issue
.
gfm_reference
}
let
(
:set_mentionable_text
)
{
->
(
txt
)
{
subject
.
note
=
txt
}
}
let
(
:set_mentionable_text
)
{
->
(
txt
)
{
subject
.
note
=
txt
}
}
end
end
...
...
spec/support/mentionable_shared_examples.rb
View file @
dee52393
# Specifications for behavior common to all Mentionable implementations.
# Specifications for behavior common to all Mentionable implementations.
# Requires a shared context containing:
# Requires a shared context containing:
# -
let(:subject)
{ "the mentionable implementation" }
# -
subject
{ "the mentionable implementation" }
# - let(:backref_text) { "the way that +subject+ should refer to itself in backreferences " }
# - let(:backref_text) { "the way that +subject+ should refer to itself in backreferences " }
# - let(:set_mentionable_text) { lambda { |txt| "block that assigns txt to the subject's mentionable_text" } }
# - let(:set_mentionable_text) { lambda { |txt| "block that assigns txt to the subject's mentionable_text" } }
...
...
spec/support/taskable_shared_examples.rb
View file @
dee52393
# Specs for task state functionality for issues and merge requests.
# Specs for task state functionality for issues and merge requests.
#
#
# Requires a context containing:
# Requires a context containing:
#
let(:subject)
{ Issue or MergeRequest }
#
subject
{ Issue or MergeRequest }
shared_examples
'a Taskable'
do
shared_examples
'a Taskable'
do
before
do
before
do
subject
.
description
=
<<
EOT
.
gsub
(
/ {6}/
,
''
)
subject
.
description
=
<<
EOT
.
gsub
(
/ {6}/
,
''
)
...
...
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