Sha256: 45a476235e5ee1f41c85a48f7cce4b33e9e2ae51ef6a265f5c8174b59cc8eeb6

Contents?: true

Size: 733 Bytes

Versions: 9

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_examples 'an API request' do |_parameter|
  it { expect { subject }.not_to raise_error }

  it('returns an array') { expect(subject).to be_a(Array) }
end

RSpec.shared_examples 'a successful request' do |_parameter|
  it('returns no error messages') do
    expect(subject[ERROR_MESSAGES]).to be_empty
  end
end

RSpec.shared_examples 'a request that raises an error' do |parameter|
  it do
    expect { subject }.to raise_error(
      parameter || FinAppsCore::MissingArgumentsError
    )
  end
end

RSpec.shared_examples 'a GET index request' do
  it { expect(results).to have_key(:records) }

  it('returns an array of records') do
    expect(results[:records]).to be_a(Array)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
finapps-6.9.2 spec/spec_helpers/api_request.rb
finapps-6.9.1 spec/spec_helpers/api_request.rb
finapps-6.9.0 spec/spec_helpers/api_request.rb
finapps-6.8.0 spec/spec_helpers/api_request.rb
finapps-6.7.1 spec/spec_helpers/api_request.rb
finapps-6.7.0 spec/spec_helpers/api_request.rb
finapps-6.6.1 spec/spec_helpers/api_request.rb
finapps-6.6.0 spec/spec_helpers/api_request.rb
finapps-6.5.0 spec/spec_helpers/api_request.rb