debian-mirror-gitlab/spec/helpers/calendar_helper_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
1 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe CalendarHelper do
2018-11-08 19:23:39 +05:30
describe '#calendar_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.calendar_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.calendar_url_options[:feed_token]).to be_nil
end
end
2021-02-22 17:27:13 +05:30
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.calendar_url_options[:feed_token]).to be_nil
end
end
2018-11-08 19:23:39 +05:30
end
end