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
db698363
Commit
db698363
authored
Sep 27, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ProjectHooks from spec/requests to spinach
parent
9cabe043
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
43 deletions
+65
-43
features/project/hooks.feature
features/project/hooks.feature
+21
-0
features/steps/project/project_hooks.rb
features/steps/project/project_hooks.rb
+36
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+4
-0
features/steps/shared/project.rb
features/steps/shared/project.rb
+4
-0
spec/requests/hooks_spec.rb
spec/requests/hooks_spec.rb
+0
-43
No files found.
features/project/hooks.feature
0 → 100644
View file @
db698363
Feature
:
Project Hooks
Background
:
Given
I sign in as a user
And
I own project
"Shop"
Scenario
:
I
should see hook list
Given
project has hook
When
I visit project hooks page
Then
I should see project hook
Scenario
:
I
add new hook
Given
I visit project hooks page
When
I submit new hook
Then
I should see newly created hook
Scenario
:
I
test hook
Given
project has hook
And
I visit project hooks page
When
I click test hook button
Then
hook should be triggered
features/steps/project/project_hooks.rb
0 → 100644
View file @
db698363
class
ProjectHooks
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
include
RSpec
::
Matchers
include
RSpec
::
Mocks
::
ExampleMethods
Given
'project has hook'
do
@hook
=
Factory
:project_hook
,
project:
current_project
end
Then
'I should see project hook'
do
page
.
should
have_content
@hook
.
url
end
When
'I submit new hook'
do
@url
=
Faker
::
Internet
.
uri
(
"http"
)
fill_in
"hook_url"
,
with:
@url
expect
{
click_button
"Add Web Hook"
}.
to
change
(
ProjectHook
,
:count
).
by
(
1
)
end
Then
'I should see newly created hook'
do
page
.
current_path
.
should
==
project_hooks_path
(
current_project
)
page
.
should
have_content
(
@url
)
end
When
'I click test hook button'
do
test_hook_context
=
double
(
execute:
true
)
TestHookContext
.
should_receive
(
:new
).
and_return
(
test_hook_context
)
click_link
'Test Hook'
end
Then
'hook should be triggered'
do
page
.
current_path
.
should
==
project_hooks_path
(
current_project
)
end
end
features/steps/shared/paths.rb
View file @
db698363
...
...
@@ -125,6 +125,10 @@ module SharedPaths
visit
project_wiki_path
(
@project
,
:index
)
end
When
'I visit project hooks page'
do
visit
project_hooks_path
(
@project
)
end
# ----------------------------------------
# "Shop" Project
# ----------------------------------------
...
...
features/steps/shared/project.rb
View file @
db698363
...
...
@@ -12,4 +12,8 @@ module SharedProject
@project
=
Factory
:project
,
:name
=>
"Shop"
@project
.
add_access
(
@user
,
:admin
)
end
def
current_project
@project
||=
Project
.
first
end
end
spec/requests/hooks_spec.rb
deleted
100644 → 0
View file @
9cabe043
require
'spec_helper'
describe
"Hooks"
do
before
do
login_as
:user
@project
=
Factory
:project
@project
.
add_access
(
@user
,
:read
,
:admin
)
end
describe
"GET index"
do
it
"should be available"
do
@hook
=
Factory
:project_hook
,
project:
@project
visit
project_hooks_path
(
@project
)
page
.
should
have_content
"Hooks"
page
.
should
have_content
@hook
.
url
end
end
describe
"New Hook"
do
before
do
@url
=
Faker
::
Internet
.
uri
(
"http"
)
visit
project_hooks_path
(
@project
)
fill_in
"hook_url"
,
with:
@url
expect
{
click_button
"Add Web Hook"
}.
to
change
(
ProjectHook
,
:count
).
by
(
1
)
end
it
"should open new team member popup"
do
page
.
current_path
.
should
==
project_hooks_path
(
@project
)
page
.
should
have_content
(
@url
)
end
end
describe
"Test"
do
before
do
@hook
=
Factory
:project_hook
,
project:
@project
stub_request
(
:post
,
@hook
.
url
)
visit
project_hooks_path
(
@project
)
click_link
"Test Hook"
end
it
{
page
.
current_path
.
should
==
project_hooks_path
(
@project
)
}
end
end
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