Commit cb50993c authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch 'js/add_feed_token_spec' into 'master'

Add feed token spec

See merge request gitlab-org/gitlab!50059
parents f32690b9 3be205a0
---
title: Add feed_token specs to spec/features/profiles/personal_access_tokens_spec.rb
merge_request: 50059
author:
type: other
...@@ -18,6 +18,10 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do ...@@ -18,6 +18,10 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
find("#created-personal-access-token").value find("#created-personal-access-token").value
end end
def feed_token
find("#feed_token").value
end
def disallow_personal_access_token_saves! def disallow_personal_access_token_saves!
allow(PersonalAccessTokens::CreateService).to receive(:new).and_return(pat_create_service) allow(PersonalAccessTokens::CreateService).to receive(:new).and_return(pat_create_service)
...@@ -112,4 +116,26 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do ...@@ -112,4 +116,26 @@ RSpec.describe 'Profile > Personal Access Tokens', :js do
end end
end end
end end
describe "feed token" do
context "when enabled" do
it "displays feed token" do
allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(false)
visit profile_personal_access_tokens_path
expect(page).to have_content("Your feed token is used to authenticate you when your RSS reader loads a personalized RSS feed or when your calendar application loads a personalized calendar, and is included in those feed URLs.")
expect(feed_token).to eq(user.feed_token)
end
end
context "when disabled" do
it "does not display feed token" do
allow(Gitlab::CurrentSettings).to receive(:disable_feed_token).and_return(true)
visit profile_personal_access_tokens_path
expect(page).not_to have_content("Your feed token is used to authenticate you when your RSS reader loads a personalized RSS feed or when your calendar application loads a personalized calendar, and is included in those feed URLs.")
expect(page).not_to have_css("#feed_token")
end
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment