Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_hooks.rb « project « steps « features - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1786fe5bc05ac73ee45da631e44726cf642492c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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