2015-08-25 21:42:46 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2015-09-15 09:42:02 -04:00
|
|
|
describe 'Triggers' do
|
2015-09-29 04:37:31 -04:00
|
|
|
let(:user) { create(:user) }
|
|
|
|
before { login_as(user) }
|
2015-09-15 15:22:51 -04:00
|
|
|
|
2015-08-25 21:42:46 -04:00
|
|
|
before do
|
2015-09-15 09:42:02 -04:00
|
|
|
@project = FactoryGirl.create :ci_project
|
2015-09-29 04:37:31 -04:00
|
|
|
@gl_project = @project.gl_project
|
|
|
|
@gl_project.team << [user, :master]
|
|
|
|
visit namespace_project_triggers_path(@gl_project.namespace, @gl_project)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'create a trigger' do
|
|
|
|
before do
|
|
|
|
click_on 'Add Trigger'
|
2015-09-10 10:55:09 -04:00
|
|
|
expect(@project.triggers.count).to eq(1)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains trigger token' do
|
2015-09-10 10:55:09 -04:00
|
|
|
expect(page).to have_content(@project.triggers.first.token)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'revokes the trigger' do
|
|
|
|
click_on 'Revoke'
|
2015-09-10 10:55:09 -04:00
|
|
|
expect(@project.triggers.count).to eq(0)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|