diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-11 13:41:35 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-08-11 13:41:35 +0400 |
commit | 7122a823f859a1201428791e32000c4a8bcc6787 (patch) | |
tree | 6336bb24752f3c9758a3ccf4233a63655f95f485 /features | |
parent | 42d4ed3a40105906b47d694a85d7f453688f93dc (diff) | |
parent | 7cefdb49eb460e87e3c3b827af32ae1b6834c4da (diff) |
Merge pull request #7393 from Razer6/fix_500_hook_service_down
Prevent 500 if hook url is down when testing a hook, fixes #7376
Diffstat (limited to 'features')
-rw-r--r-- | features/project/hooks.feature | 6 | ||||
-rw-r--r-- | features/steps/project/hooks.rb | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/features/project/hooks.feature b/features/project/hooks.feature index 52e02a890dd..1a60846a23e 100644 --- a/features/project/hooks.feature +++ b/features/project/hooks.feature @@ -24,3 +24,9 @@ Feature: Project Hooks And I visit project hooks page When I click test hook button Then I should see hook error message + + Scenario: I test a hook on down URL + Given project has hook + And I visit project hooks page + When I click test hook button with invalid URL + Then I should see hook service down error message diff --git a/features/steps/project/hooks.rb b/features/steps/project/hooks.rb index 30da589260d..2bd383676e7 100644 --- a/features/steps/project/hooks.rb +++ b/features/steps/project/hooks.rb @@ -38,6 +38,11 @@ class ProjectHooks < Spinach::FeatureSteps click_link 'Test Hook' end + step 'I click test hook button with invalid URL' do + stub_request(:post, @hook.url).to_raise(SocketError) + click_link 'Test Hook' + end + step 'hook should be triggered' do page.current_path.should == project_hooks_path(current_project) page.should have_selector '.flash-notice', @@ -49,4 +54,11 @@ class ProjectHooks < Spinach::FeatureSteps text: 'Hook execution failed. '\ 'Ensure the project has commits.' end + + step 'I should see hook service down error message' do + page.should have_selector '.flash-alert', + text: 'Hook execution failed. '\ + 'Ensure hook URL is correct and '\ + 'service is up.' + end end |