applications_spec.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Settings / Exports' do
  4. let(:user) { Fabricate :user }
  5. before { sign_in user }
  6. describe 'GET /settings/application/:id' do
  7. context 'when user does not own application' do
  8. let(:application) { Fabricate :application }
  9. it 'returns http missing' do
  10. get settings_application_path(application)
  11. expect(response)
  12. .to have_http_status(404)
  13. end
  14. end
  15. end
  16. describe 'POST /settings/applications' do
  17. subject { post '/settings/applications', params: params }
  18. let(:params) do
  19. {
  20. doorkeeper_application: {
  21. name: 'My New App',
  22. redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
  23. website: 'http://google.com',
  24. scopes: 'read write follow',
  25. },
  26. }
  27. end
  28. it 'supports passing scope values as string' do
  29. expect { subject }
  30. .to change(Doorkeeper::Application, :count).by(1)
  31. expect(response)
  32. .to redirect_to(settings_applications_path)
  33. end
  34. end
  35. end