Commit 4e2c34d81b46b97929ca1db3fe1c2a1f77b03552
1 parent
7bcd112a
Exists in
spb-stable
and in
3 other branches
Test hook properly
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
features/steps/project/project_hooks.rb
1 | +require 'webmock' | ||
2 | + | ||
1 | class ProjectHooks < Spinach::FeatureSteps | 3 | class ProjectHooks < Spinach::FeatureSteps |
2 | include SharedAuthentication | 4 | include SharedAuthentication |
3 | include SharedProject | 5 | include SharedProject |
4 | include SharedPaths | 6 | include SharedPaths |
5 | include RSpec::Matchers | 7 | include RSpec::Matchers |
6 | include RSpec::Mocks::ExampleMethods | 8 | include RSpec::Mocks::ExampleMethods |
9 | + include WebMock::API | ||
7 | 10 | ||
8 | Given 'project has hook' do | 11 | Given 'project has hook' do |
9 | @hook = create(:project_hook, project: current_project) | 12 | @hook = create(:project_hook, project: current_project) |
@@ -25,8 +28,7 @@ class ProjectHooks < Spinach::FeatureSteps | @@ -25,8 +28,7 @@ class ProjectHooks < Spinach::FeatureSteps | ||
25 | end | 28 | end |
26 | 29 | ||
27 | When 'I click test hook button' do | 30 | When 'I click test hook button' do |
28 | - test_hook_context = double(execute: true) | ||
29 | - TestHookContext.should_receive(:new).and_return(test_hook_context) | 31 | + stub_request(:post, @hook.url).to_return(status: 200) |
30 | click_link 'Test Hook' | 32 | click_link 'Test Hook' |
31 | end | 33 | end |
32 | 34 |