Sha256: 617ada2152a6fa7fa8de29ed4b54ed6554d8a96f7a3816c9fd43815b51a16821

Contents?: true

Size: 1.43 KB

Versions: 42

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

RSpec.describe FinApps::REST::TenantAppSettings do
  include SpecHelpers::Client
  subject { described_class.new(client) }

  describe '#show' do
    let(:show) { subject.show }

    it { expect { show }.not_to raise_error }

    it('performs a get and returns the response') do
      expect(show[RESULTS]).to have_key(:pdf_statement_months)
    end

    it('returns no error messages') { expect(show[ERROR_MESSAGES]).to be_empty }
  end

  describe '#update' do
    let(:update) { subject.update(params) }

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

      it do
        expect { update }.to raise_error(FinAppsCore::MissingArgumentsError)
      end
    end

    context 'when valid params are provided' do
      let(:params) { {pdf_statement_months: 2} }

      it { expect { update }.not_to raise_error }

      it('performs put and returns no content') do
        expect(update[RESULTS]).to be_nil
      end

      it('error_messages array is empty') do
        expect(update[ERROR_MESSAGES]).to be_empty
      end
    end

    context 'when invalid params are provided' do
      let(:params) { {pdf_statement_months: nil} }

      it { expect { update }.not_to raise_error }
      it('results is nil') { expect(update[RESULTS]).to be_nil }

      it('error_messages array is populated') do
        expect(update[ERROR_MESSAGES]).not_to be_empty
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

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