2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-12 14:17:19 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'User manages applications' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
visit applications_profile_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'manages applications' do
|
|
|
|
expect(page).to have_content 'Add new application'
|
|
|
|
|
|
|
|
fill_in :doorkeeper_application_name, with: 'test'
|
|
|
|
fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com'
|
|
|
|
click_on 'Save application'
|
|
|
|
|
|
|
|
expect(page).to have_content 'Application: test'
|
2018-10-03 04:31:03 -04:00
|
|
|
expect(page).to have_content 'Application ID'
|
2018-02-12 14:17:19 -05:00
|
|
|
expect(page).to have_content 'Secret'
|
2020-01-22 13:08:47 -05:00
|
|
|
expect(page).to have_content 'Confidential Yes'
|
2018-02-12 14:17:19 -05:00
|
|
|
|
|
|
|
click_on 'Edit'
|
|
|
|
|
|
|
|
expect(page).to have_content 'Edit application'
|
|
|
|
fill_in :doorkeeper_application_name, with: 'test_changed'
|
2020-01-22 13:08:47 -05:00
|
|
|
uncheck :doorkeeper_application_confidential
|
2018-02-12 14:17:19 -05:00
|
|
|
click_on 'Save application'
|
|
|
|
|
|
|
|
expect(page).to have_content 'test_changed'
|
2018-10-03 04:31:03 -04:00
|
|
|
expect(page).to have_content 'Application ID'
|
2018-02-12 14:17:19 -05:00
|
|
|
expect(page).to have_content 'Secret'
|
2020-01-22 13:08:47 -05:00
|
|
|
expect(page).to have_content 'Confidential No'
|
2018-02-12 14:17:19 -05:00
|
|
|
|
|
|
|
visit applications_profile_path
|
|
|
|
|
|
|
|
page.within '.oauth-applications' do
|
|
|
|
click_on 'Destroy'
|
|
|
|
end
|
|
|
|
expect(page.find('.oauth-applications')).not_to have_content 'test_changed'
|
|
|
|
end
|
|
|
|
end
|