diff options
author | Simon Vocella <voxsim@gmail.com> | 2016-12-28 19:19:08 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-03-01 01:15:39 +0300 |
commit | a3dfb58e7f1b1a3df4a4c16b2d09e50831370a69 (patch) | |
tree | e97662cc1d8ec3691184316f71e942bb6476249c /spec/controllers/profiles | |
parent | 81246e5649a8fb9e73369cbd117505a546d7e807 (diff) |
add impersonation token
Diffstat (limited to 'spec/controllers/profiles')
-rw-r--r-- | spec/controllers/profiles/personal_access_tokens_spec.rb | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/spec/controllers/profiles/personal_access_tokens_spec.rb b/spec/controllers/profiles/personal_access_tokens_spec.rb index 96b3b7d1b24..ac330d15e95 100644 --- a/spec/controllers/profiles/personal_access_tokens_spec.rb +++ b/spec/controllers/profiles/personal_access_tokens_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe Profiles::PersonalAccessTokensController do let(:user) { create(:user) } + before { sign_in(user) } + describe '#create' do def created_token PersonalAccessToken.order(:created_at).last end - before { sign_in(user) } - it "allows creation of a token" do name = FFaker::Product.brand @@ -46,4 +46,29 @@ describe Profiles::PersonalAccessTokensController do end end end + + describe '#index' do + let!(:active_personal_access_token) { create(:personal_access_token, user: user) } + let!(:inactive_personal_access_token) { create(:revoked_personal_access_token, user: user) } + let!(:impersonation_personal_access_token) { create(:impersonation_personal_access_token, user: user) } + + it "retrieves active personal access tokens" do + get :index + + expect(assigns(:active_personal_access_tokens)).to include(active_personal_access_token) + end + + it "retrieves inactive personal access tokens" do + get :index + + expect(assigns(:inactive_personal_access_tokens)).to include(inactive_personal_access_token) + end + + it "does not retrieve impersonation personal access tokens" do + get :index + + expect(assigns(:active_personal_access_tokens)).not_to include(impersonation_personal_access_token) + expect(assigns(:inactive_personal_access_tokens)).not_to include(impersonation_personal_access_token) + end + end end |