Sha256: a7d02a0719280af53441948a7386291359f388071e2b38ac4ca375e2bce9d15a

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Osso::GraphQL::Schema do
  describe 'DeleteOauthClient' do
    let!(:oauth_client) { create(:oauth_client) }
    let(:variables) do
      {
        input: {
          id: oauth_client.id,
        },
      }
    end

    let(:mutation) do
      <<~GRAPHQL
         mutation DeleteOauthClient($input: DeleteOauthClientInput!) {
          deleteOauthClient(input: $input) {
            oauthClient {
              id
            }
          }
        }
      GRAPHQL
    end

    subject do
      described_class.execute(
        mutation,
        variables: variables,
        context: { scope: current_scope },
      )
    end

    describe 'for an admin user' do
      let(:current_scope) { :admin }
      it 'deletes the OauthClient' do
        expect { subject }.to change { Osso::Models::OauthClient.count }.by(-1)
      end
    end

    describe 'for an email scoped user' do
      let(:current_scope) { 'foo.com' }

      it 'does not create an OauthClient Account' do
        expect { subject }.to_not(change { Osso::Models::OauthClient.count })
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
osso-0.0.3.16 spec/graphql/mutations/delete_oauth_client_spec.rb
osso-0.0.3.15 spec/graphql/mutations/delete_oauth_client_spec.rb
osso-0.0.3.14 spec/graphql/mutations/delete_oauth_client_spec.rb
osso-0.0.3.13 spec/graphql/mutations/delete_oauth_client_spec.rb
osso-0.0.3.12 spec/graphql/mutations/delete_oauth_client_spec.rb
osso-0.0.3.11 spec/graphql/mutations/delete_oauth_client_spec.rb
osso-0.0.3.9 spec/graphql/mutations/delete_oauth_client_spec.rb