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
3bf8f097
Commit
3bf8f097
authored
Mar 25, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git hook sample: tests
parent
ca538143
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
0 deletions
+50
-0
features/admin/git_hooks.feature
features/admin/git_hooks.feature
+9
-0
features/steps/admin/git_hooks.rb
features/steps/admin/git_hooks.rb
+20
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+4
-0
spec/factories/git_hooks.rb
spec/factories/git_hooks.rb
+4
-0
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+13
-0
No files found.
features/admin/git_hooks.feature
0 → 100644
View file @
3bf8f097
@admin
Feature
:
Admin git hooks sample
Background
:
Given
I sign in as an admin
And
I visit git hooks page
Scenario
:
I
can create git hook sample
When
I fill in a form and submit
Then
I see my git hook saved
\ No newline at end of file
features/steps/admin/git_hooks.rb
0 → 100644
View file @
3bf8f097
require
'webmock'
class
Spinach::Features::AdminGitHooksSample
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
include
RSpec
::
Matchers
include
RSpec
::
Mocks
::
ExampleMethods
include
WebMock
::
API
step
'I fill in a form and submit'
do
fill_in
"Commit message"
,
with:
"my_string"
click_button
"Save Git hooks"
end
step
'I see my git hook saved'
do
visit
admin_git_hooks_path
expect
(
page
).
to
have_selector
(
"input[value='my_string']"
)
end
end
features/steps/shared/paths.rb
View file @
3bf8f097
...
...
@@ -199,6 +199,10 @@ module SharedPaths
visit
admin_applications_path
end
step
'I visit git hooks page'
do
visit
admin_git_hooks_path
end
# ----------------------------------------
# Generic Project
# ----------------------------------------
...
...
spec/factories/git_hooks.rb
View file @
3bf8f097
...
...
@@ -7,5 +7,9 @@ FactoryGirl.define do
delete_branch_regex
"MyString"
project
commit_message_regex
"MyString"
factory
:git_hook_sample
do
is_sample
true
end
end
end
spec/services/projects/create_service_spec.rb
View file @
3bf8f097
...
...
@@ -82,6 +82,19 @@ describe Projects::CreateService do
expect
(
project
.
saved?
).
to
be
(
true
)
end
end
context
"git hook sample"
do
before
do
@git_hook_sample
=
create
:git_hook_sample
end
it
"creates git hook from sample"
do
git_hook
=
create_project
(
@user
,
@opts
).
git_hook
[
:force_push_regex
,
:deny_delete_tag
,
:delete_branch_regex
,
:commit_message_regex
].
each
do
|
attr_name
|
git_hook
.
send
(
attr_name
).
should
==
@git_hook_sample
.
send
(
attr_name
)
end
end
end
end
def
create_project
(
user
,
opts
)
...
...
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