debian-mirror-gitlab/spec/features/admin/admin_hooks_spec.rb

52 lines
1.1 KiB
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
require 'spec_helper'
describe "Admin::Hooks", feature: true do
before do
@project = create(:project)
login_as :admin
@system_hook = create(:system_hook)
end
describe "GET /admin/hooks" do
2016-09-13 17:45:13 +05:30
it "is ok" do
2014-09-02 18:07:02 +05:30
visit admin_root_path
page.within ".layout-nav" do
2014-09-02 18:07:02 +05:30
click_on "Hooks"
end
2015-04-26 12:48:37 +05:30
expect(current_path).to eq(admin_hooks_path)
2014-09-02 18:07:02 +05:30
end
2016-09-13 17:45:13 +05:30
it "has hooks list" do
2014-09-02 18:07:02 +05:30
visit admin_hooks_path
2015-04-26 12:48:37 +05:30
expect(page).to have_content(@system_hook.url)
2014-09-02 18:07:02 +05:30
end
end
describe "New Hook" do
before do
2015-09-11 14:41:01 +05:30
@url = FFaker::Internet.uri("http")
2014-09-02 18:07:02 +05:30
visit admin_hooks_path
fill_in "hook_url", with: @url
expect { click_button "Add System Hook" }.to change(SystemHook, :count).by(1)
end
2016-09-13 17:45:13 +05:30
it "opens new hook popup" do
2015-04-26 12:48:37 +05:30
expect(current_path).to eq(admin_hooks_path)
expect(page).to have_content(@url)
2014-09-02 18:07:02 +05:30
end
end
describe "Test" do
before do
WebMock.stub_request(:post, @system_hook.url)
visit admin_hooks_path
click_link "Test Hook"
end
2015-04-26 12:48:37 +05:30
it { expect(current_path).to eq(admin_hooks_path) }
2014-09-02 18:07:02 +05:30
end
end