2012-04-26 19:43:12 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Hooks" do
|
|
|
|
before do
|
|
|
|
login_as :user
|
|
|
|
@project = Factory :project
|
|
|
|
@project.add_access(@user, :read, :admin)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET index" do
|
|
|
|
it "should be available" do
|
2012-08-11 00:07:50 +02:00
|
|
|
@hook = Factory :project_hook, project: @project
|
2012-04-26 19:43:12 +02:00
|
|
|
visit project_hooks_path(@project)
|
|
|
|
page.should have_content "Hooks"
|
|
|
|
page.should have_content @hook.url
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "New Hook" do
|
|
|
|
before do
|
2012-05-29 14:35:34 +02:00
|
|
|
@url = Faker::Internet.uri("http")
|
2012-04-26 19:43:12 +02:00
|
|
|
visit project_hooks_path(@project)
|
2012-08-11 00:07:50 +02:00
|
|
|
fill_in "hook_url", with: @url
|
2012-07-15 16:36:06 +02:00
|
|
|
expect { click_button "Add Web Hook" }.to change(ProjectHook, :count).by(1)
|
2012-04-26 19:43:12 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should open new team member popup" do
|
|
|
|
page.current_path.should == project_hooks_path(@project)
|
|
|
|
page.should have_content(@url)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-29 14:35:34 +02:00
|
|
|
describe "Test" do
|
|
|
|
before do
|
2012-08-11 00:07:50 +02:00
|
|
|
@hook = Factory :project_hook, project: @project
|
2012-07-15 16:36:06 +02:00
|
|
|
stub_request(:post, @hook.url)
|
2012-04-26 19:43:12 +02:00
|
|
|
visit project_hooks_path(@project)
|
|
|
|
click_link "Test Hook"
|
|
|
|
end
|
|
|
|
|
|
|
|
it { page.current_path.should == project_hooks_path(@project) }
|
|
|
|
end
|
|
|
|
end
|