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

rss_helper_spec.rb « helpers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 05f6ebb6c1bb25537f6ec831bbd99a993950b7f6 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe RssHelper do
  describe '#rss_url_options' do
    context 'when signed in' do
      it "includes the current_user's feed_token" do
        current_user = create(:user)
        allow(helper).to receive(:current_user).and_return(current_user)
        expect(helper.rss_url_options).to include feed_token: current_user.feed_token
      end
    end

    context 'when signed out' do
      it "does not have a feed_token" do
        allow(helper).to receive(:current_user).and_return(nil)
        expect(helper.rss_url_options[:feed_token]).to be_nil
      end
    end

    context 'when feed_token disabled' do
      it "does not have a feed_token" do
        current_user = create(:user)
        allow(helper).to receive(:current_user).and_return(current_user)
        allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(true)
        expect(helper.rss_url_options[:feed_token]).to be_nil
      end
    end
  end
end