Sha256: aecac1b541d7c1241c9a94917bf870051071dd41e671033e4fac88e852bdf791

Contents?: true

Size: 1.38 KB

Versions: 16

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

require 'spec_helpers/client'

RSpec.describe FinApps::REST::TenantAppSettings do
  include SpecHelpers::Client
  subject { FinApps::REST::TenantAppSettings.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 respond_to(: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 { expect { update }.to raise_error(FinAppsCore::MissingArgumentsError) }
    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') { expect(update[RESULTS]).to be_nil }
      it('error_messages array is empty') { expect(update[ERROR_MESSAGES]).to be_empty }
    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') { expect(update[ERROR_MESSAGES]).not_to be_empty }
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
finapps-5.0.3 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.2 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.1 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.0 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.16 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.15 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.14 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.12 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.11 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.10 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.9 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.8 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.7 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.6 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.5 spec/rest/tenant_app_settings_spec.rb
finapps-4.0.4 spec/rest/tenant_app_settings_spec.rb