BigW Consortium Gitlab

group_links_spec.rb 872 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
require 'spec_helper'

feature 'Project group links', feature: true, js: true do
  include Select2Helper

  let(:master) { create(:user) }
  let(:project) { create(:project) }
  let!(:group) { create(:group) }

  background do
    project.team << [master, :master]
    login_as(master)
  end

  context 'setting an expiration date for a group link' do
    before do
      visit namespace_project_group_links_path(project.namespace, project)

      select2 group.id, from: '#link_group_id'
      fill_in 'expires_at', with: (Time.current + 4.5.days).strftime('%Y-%m-%d')
      page.find('body').click
      click_on 'Share'
    end

    it 'shows the expiration time with a warning class' do
      page.within('.enabled-groups') do
        expect(page).to have_content('expires in 4 days')
        expect(page).to have_selector('.text-warning')
      end
    end
  end
end