triggers_spec.rb 645 Bytes
Newer Older
1 2
require 'spec_helper'

Valery Sizov's avatar
Valery Sizov committed
3
describe 'Triggers' do
4 5
  let(:user) { create(:user) }
  before { login_as(user) }
6

7
  before do
8 9 10
    @project = FactoryGirl.create :empty_project
    @project.team << [user, :master]
    visit namespace_project_triggers_path(@project.namespace, @project)
11 12 13 14 15
  end

  context 'create a trigger' do
    before do
      click_on 'Add Trigger'
16
      expect(@project.triggers.count).to eq(1)
17 18 19
    end

    it 'contains trigger token' do
20
      expect(page).to have_content(@project.triggers.first.token)
21 22 23 24
    end

    it 'revokes the trigger' do
      click_on 'Revoke'
25
      expect(@project.triggers.count).to eq(0)
26 27 28
    end
  end
end