BigW Consortium Gitlab

_home_panel.html.haml_spec.rb 920 Bytes
Newer Older
1 2
require 'spec_helper'

3
describe 'projects/_home_panel' do
4
  let(:project) { create(:project, :public) }
5 6

  let(:notification_settings) do
Alfredo Sumaran committed
7
    user&.notification_settings_for(project)
8 9 10 11 12 13 14 15 16 17
  end

  before do
    assign(:project, project)
    assign(:notification_setting, notification_settings)

    allow(view).to receive(:current_user).and_return(user)
    allow(view).to receive(:can?).and_return(false)
  end

18
  context 'when user is signed in' do
19 20 21 22 23 24 25 26 27 28
    let(:user) { create(:user) }

    it 'makes it possible to set notification level' do
      render

      expect(view).to render_template('shared/notifications/_button')
      expect(rendered).to have_selector('.notification-dropdown')
    end
  end

29
  context 'when user is signed out' do
30 31 32 33 34 35 36 37 38
    let(:user) { nil }

    it 'is not possible to set notification level' do
      render

      expect(rendered).not_to have_selector('.notification_dropdown')
    end
  end
end