diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-03-02 20:50:33 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-03-02 20:50:33 +0300 |
commit | f14ee823d703119aed8500f3cd868f12bcd103bc (patch) | |
tree | c362456e756341700985b8ea8af9683ca50cc28e /spec/support | |
parent | 8ec8b2da66c27124cf049ca77472f5aabc77b759 (diff) | |
parent | d82f2d0eb2a6c182bfa50992dddbb0824290199f (diff) |
Merge branch '2629-show-public-rss-feeds-to-anonymous-users' into 'master'
Show public RSS feeds to anonymous users
Closes #2629
See merge request !9596
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/features/rss_shared_examples.rb | 23 | ||||
-rw-r--r-- | spec/support/project_features_apply_to_issuables_shared_examples.rb | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/spec/support/features/rss_shared_examples.rb b/spec/support/features/rss_shared_examples.rb new file mode 100644 index 00000000000..9a3b0a731ad --- /dev/null +++ b/spec/support/features/rss_shared_examples.rb @@ -0,0 +1,23 @@ +shared_examples "an autodiscoverable RSS feed with current_user's private token" do + it "has an RSS autodiscovery link tag with current_user's private token" do + expect(page).to have_css("link[type*='atom+xml'][href*='private_token=#{Thread.current[:current_user].private_token}']", visible: false) + end +end + +shared_examples "it has an RSS button with current_user's private token" do + it "shows the RSS button with current_user's private token" do + expect(page).to have_css("a:has(.fa-rss)[href*='private_token=#{Thread.current[:current_user].private_token}']") + end +end + +shared_examples "an autodiscoverable RSS feed without a private token" do + it "has an RSS autodiscovery link tag without a private token" do + expect(page).to have_css("link[type*='atom+xml']:not([href*='private_token'])", visible: false) + end +end + +shared_examples "it has an RSS button without a private token" do + it "shows the RSS button without a private token" do + expect(page).to have_css("a:has(.fa-rss):not([href*='private_token'])") + end +end diff --git a/spec/support/project_features_apply_to_issuables_shared_examples.rb b/spec/support/project_features_apply_to_issuables_shared_examples.rb index 4621d17549b..f8b7d0527ba 100644 --- a/spec/support/project_features_apply_to_issuables_shared_examples.rb +++ b/spec/support/project_features_apply_to_issuables_shared_examples.rb @@ -18,7 +18,7 @@ shared_examples 'project features apply to issuables' do |klass| before do _ = issuable - login_as(user) + login_as(user) if user visit path end |