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-12-04 06:55:23 -05:00
|
|
|
@project = FactoryGirl.create :empty_project
|
|
|
|
@project.team << [user, :master]
|
|
|
|
visit namespace_project_triggers_path(@project.namespace, @project)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'create a trigger' do
|
|
|
|
before do
|
2016-09-06 05:52:01 -04:00
|
|
|
click_on 'Add trigger'
|
2015-12-10 11:44:06 -05:00
|
|
|
expect(@project.triggers.count).to eq(1)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'contains trigger token' do
|
2015-12-10 11:44:06 -05: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-12-10 11:44:06 -05:00
|
|
|
expect(@project.triggers.count).to eq(0)
|
2015-08-25 21:42:46 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|