Sha256: bbd1e31ed6368e321b49e821747a6759855ae51fc769884e77a2a31f4dd72225

Contents?: true

Size: 1.14 KB

Versions: 15

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true
RSpec.describe FinApps::REST::InstitutionsForms do
  let(:client) { FinApps::REST::Client.new(:company_identifier, :company_token) }
  describe '#show' do
    context 'when missing site id' do
      subject { FinApps::REST::InstitutionsForms.new(client).show(nil) }
      it('raises missing argument error') { expect { subject }.to raise_error(FinApps::MissingArgumentsError) }
    end

    context 'when valid site id provided' do
      subject { FinApps::REST::InstitutionsForms.new(client).show('valid_site_id') }

      it { expect { subject }.not_to raise_error }
      it('performs a get and returns the login html') { expect(subject[0]).to respond_to(:login_form_html) }
      it('returns no error messages') { expect(subject[1]).to be_empty }
    end

    context 'when invalid site id provided' do
      subject { FinApps::REST::InstitutionsForms.new(client).show('invalid_site_id') }

      it { expect { subject }.not_to raise_error }
      it('results is nil') { expect(subject[0]).to be_nil }
      it('error messages array is populated') { expect(subject[1].first.downcase).to eq('invalid institution id') }
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
finapps-2.1.4 spec/rest/institutions_forms_spec.rb
finapps-2.1.3 spec/rest/institutions_forms_spec.rb
finapps-2.1.2 spec/rest/institutions_forms_spec.rb
finapps-2.1.1 spec/rest/institutions_forms_spec.rb
finapps-2.0.30 spec/rest/institutions_forms_spec.rb
finapps-2.0.29 spec/rest/institutions_forms_spec.rb
finapps-2.0.28 spec/rest/institutions_forms_spec.rb
finapps-2.0.27 spec/rest/institutions_forms_spec.rb
finapps-2.0.26 spec/rest/institutions_forms_spec.rb
finapps-2.0.25 spec/rest/institutions_forms_spec.rb
finapps-2.0.24 spec/rest/institutions_forms_spec.rb
finapps-2.0.23 spec/rest/institutions_forms_spec.rb
finapps-2.0.22 spec/rest/institutions_forms_spec.rb
finapps-2.0.21 spec/rest/institutions_forms_spec.rb
finapps-2.0.20 spec/rest/institutions_forms_spec.rb