-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ProjectHooks from spec/requests to spinach
- Loading branch information
1 parent
9cabe04
commit db69836
Showing
5 changed files
with
65 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.