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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
169dc4ce
Commit
169dc4ce
authored
Mar 23, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix brittle specs
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
5f7cb263
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
15 deletions
+14
-15
spec/factories/issues.rb
spec/factories/issues.rb
+1
-1
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+1
-1
spec/factories/sequences.rb
spec/factories/sequences.rb
+2
-0
spec/factories/snippets.rb
spec/factories/snippets.rb
+3
-6
spec/features/admin/admin_browse_spam_logs_spec.rb
spec/features/admin/admin_browse_spam_logs_spec.rb
+1
-1
spec/features/issuables/issuable_list_spec.rb
spec/features/issuables/issuable_list_spec.rb
+2
-2
spec/support/cycle_analytics_helpers.rb
spec/support/cycle_analytics_helpers.rb
+2
-2
spec/support/filter_spec_helper.rb
spec/support/filter_spec_helper.rb
+2
-2
No files found.
spec/factories/issues.rb
View file @
169dc4ce
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:issue
do
factory
:issue
do
title
title
{
generate
(
:title
)
}
author
author
project
factory: :empty_project
project
factory: :empty_project
...
...
spec/factories/merge_requests.rb
View file @
169dc4ce
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:merge_request
do
factory
:merge_request
do
title
title
{
generate
(
:title
)
}
author
author
association
:source_project
,
:repository
,
factory: :project
association
:source_project
,
:repository
,
factory: :project
target_project
{
source_project
}
target_project
{
source_project
}
...
...
spec/factories/sequences.rb
View file @
169dc4ce
...
@@ -3,6 +3,8 @@ FactoryGirl.define do
...
@@ -3,6 +3,8 @@ FactoryGirl.define do
sequence
(
:name
)
{
|
n
|
"John Doe
#{
n
}
"
}
sequence
(
:name
)
{
|
n
|
"John Doe
#{
n
}
"
}
sequence
(
:email
)
{
|
n
|
"user
#{
n
}
@example.org"
}
sequence
(
:email
)
{
|
n
|
"user
#{
n
}
@example.org"
}
sequence
(
:email_alias
)
{
|
n
|
"user.alias
#{
n
}
@example.org"
}
sequence
(
:email_alias
)
{
|
n
|
"user.alias
#{
n
}
@example.org"
}
sequence
(
:title
)
{
|
n
|
"My title
#{
n
}
"
}
sequence
(
:filename
)
{
|
n
|
"filename-
#{
n
}
.rb"
}
sequence
(
:url
)
{
|
n
|
"http://example
#{
n
}
.org"
}
sequence
(
:url
)
{
|
n
|
"http://example
#{
n
}
.org"
}
sequence
(
:label
)
{
|
n
|
"label
#{
n
}
"
}
sequence
(
:label
)
{
|
n
|
"label
#{
n
}
"
}
sequence
(
:branch
)
{
|
n
|
"my-branch-
#{
n
}
"
}
sequence
(
:branch
)
{
|
n
|
"my-branch-
#{
n
}
"
}
...
...
spec/factories/snippets.rb
View file @
169dc4ce
FactoryGirl
.
define
do
FactoryGirl
.
define
do
sequence
(
:title
,
aliases:
[
:content
])
{
|
n
|
"My snippet
#{
n
}
"
}
sequence
(
:file_name
)
{
|
n
|
"snippet-
#{
n
}
.rb"
}
factory
:snippet
do
factory
:snippet
do
author
author
title
title
{
generate
(
:title
)
}
content
content
{
generate
(
:title
)
}
file_name
file_name
{
generate
(
:filename
)
}
trait
:public
do
trait
:public
do
visibility_level
Snippet
::
PUBLIC
visibility_level
Snippet
::
PUBLIC
...
...
spec/features/admin/admin_browse_spam_logs_spec.rb
View file @
169dc4ce
require
'spec_helper'
require
'spec_helper'
describe
'Admin browse spam logs'
do
describe
'Admin browse spam logs'
do
let!
(
:spam_log
)
{
create
(
:spam_log
)
}
let!
(
:spam_log
)
{
create
(
:spam_log
,
description:
'abcde '
*
20
)
}
before
do
before
do
login_as
:admin
login_as
:admin
...
...
spec/features/issuables/issuable_list_spec.rb
View file @
169dc4ce
...
@@ -51,7 +51,7 @@ describe 'issuable list', feature: true do
...
@@ -51,7 +51,7 @@ describe 'issuable list', feature: true do
if
issuable_type
==
:issue
if
issuable_type
==
:issue
create
(
:issue
,
project:
project
,
author:
user
)
create
(
:issue
,
project:
project
,
author:
user
)
else
else
create
(
:merge_request
,
source_project:
project
,
source_branch:
"
#{
n
}
-feature"
)
create
(
:merge_request
,
source_project:
project
,
source_branch:
generate
(
:branch
)
)
end
end
2
.
times
do
2
.
times
do
...
@@ -66,7 +66,7 @@ describe 'issuable list', feature: true do
...
@@ -66,7 +66,7 @@ describe 'issuable list', feature: true do
issue
=
Issue
.
reorder
(
:iid
).
first
issue
=
Issue
.
reorder
(
:iid
).
first
merge_request
=
create
(
:merge_request
,
merge_request
=
create
(
:merge_request
,
source_project:
project
,
source_project:
project
,
source_branch:
'my-bug-fix'
)
source_branch:
generate
(
:branch
)
)
MergeRequestsClosingIssues
.
create!
(
issue:
issue
,
merge_request:
merge_request
)
MergeRequestsClosingIssues
.
create!
(
issue:
issue
,
merge_request:
merge_request
)
end
end
...
...
spec/support/cycle_analytics_helpers.rb
View file @
169dc4ce
module
CycleAnalyticsHelpers
module
CycleAnalyticsHelpers
def
create_commit_referencing_issue
(
issue
,
branch_name:
nil
)
def
create_commit_referencing_issue
(
issue
,
branch_name:
generate
(
:branch
)
)
project
.
repository
.
add_branch
(
user
,
branch_name
||
generate
(
:branch
)
,
'master'
)
project
.
repository
.
add_branch
(
user
,
branch_name
,
'master'
)
create_commit
(
"Commit for #
#{
issue
.
iid
}
"
,
issue
.
project
,
user
,
branch_name
)
create_commit
(
"Commit for #
#{
issue
.
iid
}
"
,
issue
.
project
,
user
,
branch_name
)
end
end
...
...
spec/support/filter_spec_helper.rb
View file @
169dc4ce
...
@@ -63,9 +63,9 @@ module FilterSpecHelper
...
@@ -63,9 +63,9 @@ module FilterSpecHelper
#
#
# Returns a String
# Returns a String
def
invalidate_reference
(
reference
)
def
invalidate_reference
(
reference
)
if
reference
=~
/\A(.+)?
.
\d+\z/
if
reference
=~
/\A(.+)?
[^\d]
\d+\z/
# Integer-based reference with optional project prefix
# Integer-based reference with optional project prefix
reference
.
gsub
(
/\d+\z/
)
{
|
i
|
i
.
to_i
+
1
}
reference
.
gsub
(
/\d+\z/
)
{
|
i
|
i
.
to_i
+
1
0_000
}
elsif
reference
=~
/\A(.+@)?(\h{7,40}\z)/
elsif
reference
=~
/\A(.+@)?(\h{7,40}\z)/
# SHA-based reference with optional prefix
# SHA-based reference with optional prefix
reference
.
gsub
(
/\h{7,40}\z/
)
{
|
v
|
v
.
reverse
}
reference
.
gsub
(
/\h{7,40}\z/
)
{
|
v
|
v
.
reverse
}
...
...
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