2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
RSpec.describe 'admin manage applications' do
|
2017-08-17 22:00:37 +05:30
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(create(:admin))
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it do
|
|
|
|
visit admin_applications_path
|
|
|
|
|
|
|
|
click_on 'New application'
|
|
|
|
expect(page).to have_content('New application')
|
|
|
|
|
|
|
|
fill_in :doorkeeper_application_name, with: 'test'
|
|
|
|
fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com'
|
2017-09-10 17:25:29 +05:30
|
|
|
check :doorkeeper_application_trusted
|
2017-08-17 22:00:37 +05:30
|
|
|
click_on 'Submit'
|
|
|
|
expect(page).to have_content('Application: test')
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(page).to have_content('Application ID')
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('Secret')
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content('Trusted Y')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
click_on 'Edit'
|
|
|
|
expect(page).to have_content('Edit application')
|
|
|
|
|
|
|
|
fill_in :doorkeeper_application_name, with: 'test_changed'
|
2017-09-10 17:25:29 +05:30
|
|
|
uncheck :doorkeeper_application_trusted
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
click_on 'Submit'
|
|
|
|
expect(page).to have_content('test_changed')
|
2018-12-05 23:21:45 +05:30
|
|
|
expect(page).to have_content('Application ID')
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_content('Secret')
|
2017-09-10 17:25:29 +05:30
|
|
|
expect(page).to have_content('Trusted N')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
visit admin_applications_path
|
|
|
|
page.within '.oauth-applications' do
|
|
|
|
click_on 'Destroy'
|
|
|
|
end
|
|
|
|
expect(page.find('.oauth-applications')).not_to have_content('test_changed')
|
|
|
|
end
|
|
|
|
end
|