Sha256: d286028e21a6ec307fadb22722d1b7f9e5ab7a29d81b40aa92a562f74e8ac0b8

Contents?: true

Size: 1.37 KB

Versions: 24

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

RSpec.describe FinApps::REST::OperatorLoginTokens do
  context 'when initialized with valid FinApps::Client object' do
    include SpecHelpers::Client
    subject(:operator_login_tokens) { described_class.new(client) }

    describe '#create' do
      let(:results) { create[0] }
      let(:error_messages) { create[1] }

      context 'when missing params' do
        let(:create) { subject.create(nil) }

        error = FinAppsCore::MissingArgumentsError
        it { expect { create }.to raise_error(error) }
      end

      context 'when invalid params are provided' do
        let(:create) { subject.create(params: 'invalid') }

        it { expect { create }.not_to raise_error }
        it('results is nil') { expect(results).to be_nil }

        it('error messages array is populated') do
          expect(error_messages.first.downcase).to eq('invalid request body')
        end
      end

      context 'when valid params are provided' do
        let(:create) { subject.create(params: 'valid') }

        it { expect { create }.not_to raise_error }
        it('returns an array') { expect(create).to be_a(Array) }
        it { expect(results).to have_key(:public_id) }
        it { expect(results).to have_key(:role) }
        it('returns no error messages') { expect(error_messages).to be_empty }
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
finapps-6.13.1 spec/rest/operators_login_tokens_spec.rb
finapps-6.13.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.12.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.11.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.10.2 spec/rest/operators_login_tokens_spec.rb
finapps-6.10.1 spec/rest/operators_login_tokens_spec.rb
finapps-6.10.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.9.2 spec/rest/operators_login_tokens_spec.rb
finapps-6.9.1 spec/rest/operators_login_tokens_spec.rb
finapps-6.9.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.8.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.7.1 spec/rest/operators_login_tokens_spec.rb
finapps-6.7.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.6.1 spec/rest/operators_login_tokens_spec.rb
finapps-6.6.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.5.0 spec/rest/operators_login_tokens_spec.rb
finapps-6.4.3 spec/rest/operators_login_tokens_spec.rb
finapps-6.4.2 spec/rest/operators_login_tokens_spec.rb
finapps-6.4.1 spec/rest/operators_login_tokens_spec.rb
finapps-6.4.0 spec/rest/operators_login_tokens_spec.rb