Welcome to mirror list, hosted at ThFree Co, Russian Federation.

rss_spec.rb « users « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 712e50561385fa9a0f141b16b5c41be0aa1b2f3d (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'User RSS', feature_category: :user_profile do
  let(:user) { create(:user, :no_super_sidebar) }
  let(:path) { user_path(create(:user, :no_super_sidebar)) }

  describe 'with "user_profile_overflow_menu_vue" feature flag off' do
    before do
      stub_feature_flags(user_profile_overflow_menu_vue: false)
    end

    context 'when signed in' do
      before do
        sign_in(user)
        visit path
      end

      it_behaves_like "it has an RSS button with current_user's feed token"
    end

    context 'when signed out' do
      before do
        visit path
      end

      it_behaves_like "it has an RSS button without a feed token"
    end
  end

  describe 'with "user_profile_overflow_menu_vue" feature flag on', :js do
    context 'when signed in' do
      before do
        sign_in(user)
        visit path
      end

      it 'shows the RSS link with overflow menu' do
        find('[data-testid="base-dropdown-toggle"').click

        expect(page).to have_link 'Subscribe', href: /feed_token=glft-.*-#{user.id}/
      end
    end

    context 'when signed out' do
      before do
        visit path
      end

      it 'has an RSS without a feed token' do
        find('[data-testid="base-dropdown-toggle"').click

        expect(page).not_to have_link 'Subscribe', href: /feed_token=glft-.*-#{user.id}/
      end
    end
  end
end