2019-07-25 05:27:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-01-21 03:08:37 +00:00
|
|
|
RSpec.shared_examples "an autodiscoverable RSS feed with current_user's feed token" do
|
2018-05-31 14:01:04 +00:00
|
|
|
it "has an RSS autodiscovery link tag with current_user's feed token" do
|
|
|
|
expect(page).to have_css("link[type*='atom+xml'][href*='feed_token=#{user.feed_token}']", visible: false)
|
2017-02-28 20:50:57 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-01-21 03:08:37 +00:00
|
|
|
RSpec.shared_examples "it has an RSS button with current_user's feed token" do
|
2018-05-31 14:01:04 +00:00
|
|
|
it "shows the RSS button with current_user's feed token" do
|
2019-10-16 18:08:01 +00:00
|
|
|
expect(page)
|
2021-08-03 18:10:02 +00:00
|
|
|
.to have_css("a:has(.qa-rss-icon)[href*='feed_token=#{user.feed_token}']") # rubocop:disable QA/SelectorUsage
|
2017-02-28 20:50:57 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-01-21 03:08:37 +00:00
|
|
|
RSpec.shared_examples "an autodiscoverable RSS feed without a feed token" do
|
2018-05-31 14:01:04 +00:00
|
|
|
it "has an RSS autodiscovery link tag without a feed token" do
|
|
|
|
expect(page).to have_css("link[type*='atom+xml']:not([href*='feed_token'])", visible: false)
|
2017-02-28 20:50:57 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-01-21 03:08:37 +00:00
|
|
|
RSpec.shared_examples "it has an RSS button without a feed token" do
|
2018-05-31 14:01:04 +00:00
|
|
|
it "shows the RSS button without a feed token" do
|
2019-10-16 18:08:01 +00:00
|
|
|
expect(page)
|
2021-08-03 18:10:02 +00:00
|
|
|
.to have_css("a:has(.qa-rss-icon):not([href*='feed_token'])") # rubocop:disable QA/SelectorUsage
|
2017-02-28 20:50:57 +00:00
|
|
|
end
|
|
|
|
end
|
2021-08-20 09:09:16 +00:00
|
|
|
|
|
|
|
RSpec.shared_examples "updates atom feed link" do |type|
|
|
|
|
it "for #{type}" do
|
|
|
|
sign_in(user)
|
|
|
|
visit path
|
|
|
|
|
|
|
|
link = find_link('Subscribe to RSS feed')
|
|
|
|
params = CGI.parse(URI.parse(link[:href]).query)
|
|
|
|
auto_discovery_link = find("link[type='application/atom+xml']", visible: false)
|
|
|
|
auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query)
|
|
|
|
|
|
|
|
expected = {
|
|
|
|
'feed_token' => [user.feed_token],
|
|
|
|
'assignee_id' => [user.id.to_s]
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(params).to include(expected)
|
|
|
|
expect(auto_discovery_params).to include(expected)
|
|
|
|
end
|
|
|
|
end
|