BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
91eb346d
Commit
91eb346d
authored
May 12, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add invalidate_reference to ReferenceFilterSpecHelper
parent
136ab738
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
reference_filter_spec_helper.rb
spec/support/reference_filter_spec_helper.rb
+19
-0
No files found.
spec/support/reference_filter_spec_helper.rb
View file @
91eb346d
...
...
@@ -10,6 +10,25 @@ module ReferenceFilterSpecHelper
Rails
.
application
.
routes
.
url_helpers
end
# Modify a reference to make it invalid
#
# Commit SHAs get reversed, IDs get incremented by 1
#
# reference - String reference to modify
#
# Returns a String
def
invalidate_reference
(
reference
)
if
reference
=~
/\A(.+)?.\d+\z/
# Integer-based reference with optional project prefix
reference
.
gsub
(
/\d+\z/
)
{
|
i
|
i
.
to_i
+
1
}
elsif
reference
=~
/\A(.+@)?(\h{6,40}\z)/
# SHA-based reference with optional prefix
reference
.
gsub
(
/\h{6,40}\z/
)
{
|
v
|
v
.
reverse
}
else
reference
end
end
# Perform `call` on the described class
#
# Automatically passes the current `project` value to the context if none is
...
...
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