2019-09-30 12:06:01 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-28 20:50:57 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe RssHelper do
|
|
|
|
describe '#rss_url_options' do
|
|
|
|
context 'when signed in' do
|
2018-05-31 14:01:04 +00:00
|
|
|
it "includes the current_user's feed_token" do
|
2017-02-28 20:50:57 +00:00
|
|
|
current_user = create(:user)
|
|
|
|
allow(helper).to receive(:current_user).and_return(current_user)
|
2018-05-31 14:01:04 +00:00
|
|
|
expect(helper.rss_url_options).to include feed_token: current_user.feed_token
|
2017-02-28 20:50:57 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when signed out' do
|
2018-05-31 14:01:04 +00:00
|
|
|
it "does not have a feed_token" do
|
2017-02-28 20:50:57 +00:00
|
|
|
allow(helper).to receive(:current_user).and_return(nil)
|
2018-05-31 14:01:04 +00:00
|
|
|
expect(helper.rss_url_options[:feed_token]).to be_nil
|
2017-02-28 20:50:57 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|