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
Tatuya Kamada
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
spec/support/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