Skip to content
Snippets Groups Projects
Commit ba1dca79 authored by kushalpandya's avatar kushalpandya
Browse files

Update tests to cover removal of inactive tokens table

parent aca213ad
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -8,8 +8,8 @@ describe 'Admin > Users > Impersonation Tokens', feature: true, js: true do
find(".table.active-tokens")
end
 
def inactive_impersonation_tokens
find(".table.inactive-tokens")
def no_personal_access_tokens_message
find(".settings-message")
end
 
before do
Loading
Loading
@@ -60,7 +60,8 @@ describe 'Admin > Users > Impersonation Tokens', feature: true, js: true do
 
click_on "Revoke"
 
expect(inactive_impersonation_tokens).to have_text(impersonation_token.name)
expect(page).to have_selector(".settings-message")
expect(no_personal_access_tokens_message).to have_text("This user has no active Impersonation Tokens.")
end
 
it "moves expired tokens to the 'inactive' section" do
Loading
Loading
@@ -68,7 +69,8 @@ describe 'Admin > Users > Impersonation Tokens', feature: true, js: true do
 
visit admin_user_impersonation_tokens_path(user_id: user.username)
 
expect(inactive_impersonation_tokens).to have_text(impersonation_token.name)
expect(page).to have_selector(".settings-message")
expect(no_personal_access_tokens_message).to have_text("This user has no active Impersonation Tokens.")
end
end
end
Loading
Loading
@@ -7,8 +7,8 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
find(".table.active-tokens")
end
 
def inactive_personal_access_tokens
find(".table.inactive-tokens")
def no_personal_access_tokens_message
find(".settings-message")
end
 
def created_personal_access_token
Loading
Loading
@@ -80,14 +80,16 @@ describe 'Profile > Personal Access Tokens', feature: true, js: true do
visit profile_personal_access_tokens_path
click_on "Revoke"
 
expect(inactive_personal_access_tokens).to have_text(personal_access_token.name)
expect(page).to have_selector(".settings-message")
expect(no_personal_access_tokens_message).to have_text("This user has no active Personal Access Tokens.")
end
 
it "moves expired tokens to the 'inactive' section" do
it "removes expired tokens from 'active' section" do
personal_access_token.update(expires_at: 5.days.ago)
visit profile_personal_access_tokens_path
 
expect(inactive_personal_access_tokens).to have_text(personal_access_token.name)
expect(page).to have_selector(".settings-message")
expect(no_personal_access_tokens_message).to have_text("This user has no active Personal Access Tokens.")
end
 
context "when revocation fails" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment