Sha256: 745dc8794550a0a39f58dbad9e63d3c1b8d883c474f22c9447c54e8ed0b37149

Contents?: true

Size: 1014 Bytes

Versions: 3

Compression:

Stored size: 1014 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 { expect(subject).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

3 entries across 3 versions & 1 rubygems

Version Path
fortnox-api-0.8.2 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.8.1 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.9.0 spec/fortnox/api/mappers/examples/mapper.rb