diff options
author | Timothy Andrew <mail@timothyandrew.net> | 2016-11-22 14:27:31 +0530 |
---|---|---|
committer | Timothy Andrew <mail@timothyandrew.net> | 2016-12-16 15:08:10 +0530 |
commit | 6c809dfae84e702f7a49d3fac5725745264e0ff9 (patch) | |
tree | 185c6d1444abd3f884515b92f077e747cac96e1d /spec/features | |
parent | 1d0ccec6dd8375b751846f69bb170ebd11e9a391 (diff) | |
download | gitlab-ce-6c809dfae84e702f7a49d3fac5725745264e0ff9.tar.gz |
Allow creating personal access tokens / OAuth applications with scopes.
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/profiles/personal_access_tokens_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index a85930c7543..0ffeeff0921 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -51,6 +51,32 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do expect(active_personal_access_tokens).to have_text(Date.today.next_month.at_beginning_of_month.to_s(:medium)) end + context "scopes" do + it "allows creation of a token with scopes" do + visit profile_personal_access_tokens_path + fill_in "Name", with: FFaker::Product.brand + + check "api" + check "read_user" + + expect {click_on "Create Personal Access Token"}.to change { PersonalAccessToken.count }.by(1) + expect(created_personal_access_token).to eq(PersonalAccessToken.last.token) + expect(PersonalAccessToken.last.scopes).to match_array(['api', 'read_user']) + expect(active_personal_access_tokens).to have_text('api') + expect(active_personal_access_tokens).to have_text('read_user') + end + + it "allows creation of a token with no scopes" do + visit profile_personal_access_tokens_path + fill_in "Name", with: FFaker::Product.brand + + expect {click_on "Create Personal Access Token"}.to change { PersonalAccessToken.count }.by(1) + expect(created_personal_access_token).to eq(PersonalAccessToken.last.token) + expect(PersonalAccessToken.last.scopes).to eq([]) + expect(active_personal_access_tokens).to have_text('no scopes') + end + end + context "when creation fails" do it "displays an error message" do disallow_personal_access_token_saves! |