Sha256: 3da78f95258f44eea189783359b81a1ed2fa6b2b2dcdb024e7c5c49feae48bda

Contents?: true

Size: 1.44 KB

Versions: 28

Compression:

Stored size: 1.44 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 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

28 entries across 28 versions & 1 rubygems

Version Path
finapps-5.0.32 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.31 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.30 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.29 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.28 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.27 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.26 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.25 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.24 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.23 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.22 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.21 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.20 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.19 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.17 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.16 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.15 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.14 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.13 spec/rest/tenant_app_settings_spec.rb
finapps-5.0.12 spec/rest/tenant_app_settings_spec.rb