Move admin hooks spinach to rspec

https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
This commit is contained in:
Semyon Pupkov 2016-12-05 23:50:13 +05:00
parent 4e96c53197
commit d33b22f238
4 changed files with 13 additions and 32 deletions

View File

@ -0,0 +1,4 @@
---
title: Move admin hooks spinach to rspec
merge_request: 7942
author: Semyon Pupkov

View File

@ -1,9 +0,0 @@
@admin
Feature: Admin Hooks
Background:
Given I sign in as an admin
Scenario: On Admin Hooks
Given I visit admin hooks page
Then I submit the form with enabled SSL verification
And I see new hook with enabled SSL verification

View File

@ -1,15 +0,0 @@
class Spinach::Features::AdminHooks < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedAdmin
step "I submit the form with enabled SSL verification" do
fill_in 'hook_url', with: 'http://google.com'
check "Enable SSL verification"
click_on "Add System Hook"
end
step "I see new hook with enabled SSL verification" do
expect(page).to have_content "SSL Verification: enabled"
end
end

View File

@ -26,16 +26,17 @@ describe "Admin::Hooks", feature: true do
end
describe "New Hook" do
before do
@url = FFaker::Internet.uri("http")
visit admin_hooks_path
fill_in "hook_url", with: @url
expect { click_button "Add System Hook" }.to change(SystemHook, :count).by(1)
end
let(:url) { FFaker::Internet.uri('http') }
it "opens new hook popup" do
it 'adds new hook' do
visit admin_hooks_path
fill_in 'hook_url', with: url
check 'Enable SSL verification'
expect { click_button 'Add System Hook' }.to change(SystemHook, :count).by(1)
expect(page).to have_content 'SSL Verification: enabled'
expect(current_path).to eq(admin_hooks_path)
expect(page).to have_content(@url)
expect(page).to have_content(url)
end
end