Sha256: 7010595d8a29fbbfd71f3eb860283c0b42083c20c72c6d87ac58d89b59fc5354

Contents?: true

Size: 1010 Bytes

Versions: 8

Compression:

Stored size: 1010 Bytes

Contents

# frozen_string_literal: true

# rubocop:disable Metrics/LineLength
shared_examples_for 'mapper' do |key_map, json_entity_wrapper = nil, json_collection_wrapper = nil, check_constants: true|
  # rubocop:enable Metrics/LineLength

  it { is_expected.to respond_to(:wrapped_json_collection_to_entities_hash) }
  it { is_expected.to respond_to(:wrapped_json_hash_to_entity_hash) }
  it { is_expected.to respond_to(:entity_to_hash) }

  if check_constants
    describe 'key_map' do
      subject { described_class::KEY_MAP }

      it { is_expected.to eq(key_map) }
    end

    unless json_entity_wrapper.nil?
      describe 'json_entity_wrapper' do
        subject { described_class::JSON_ENTITY_WRAPPER }

        it { is_expected.to eq(json_entity_wrapper) }
      end
    end

    unless json_collection_wrapper.nil?
      describe 'json_collection_wrapper' do
        subject { described_class::JSON_COLLECTION_WRAPPER }

        it { is_expected.to eq(json_collection_wrapper) }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fortnox-api-0.8.0 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.7.2 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.7.1 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.7.0 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.6.3 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.6.2 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.6.1 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.6.0 spec/fortnox/api/mappers/examples/mapper.rb