Commit 4e2c34d8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Test hook properly

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 7bcd112a
require 'webmock'
class ProjectHooks < Spinach::FeatureSteps class ProjectHooks < Spinach::FeatureSteps
include SharedAuthentication include SharedAuthentication
include SharedProject include SharedProject
include SharedPaths include SharedPaths
include RSpec::Matchers include RSpec::Matchers
include RSpec::Mocks::ExampleMethods include RSpec::Mocks::ExampleMethods
include WebMock::API
Given 'project has hook' do Given 'project has hook' do
@hook = create(:project_hook, project: current_project) @hook = create(:project_hook, project: current_project)
...@@ -25,8 +28,7 @@ class ProjectHooks < Spinach::FeatureSteps ...@@ -25,8 +28,7 @@ class ProjectHooks < Spinach::FeatureSteps
end end
When 'I click test hook button' do When 'I click test hook button' do
test_hook_context = double(execute: true) stub_request(:post, @hook.url).to_return(status: 200)
TestHookContext.should_receive(:new).and_return(test_hook_context)
click_link 'Test Hook' click_link 'Test Hook'
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment