Sha256: 8d18afe44a35ccd39b1a9612ccbbed4e91ac141ff89e6e0b63fc7cffac18f6fa

Contents?: true

Size: 891 Bytes

Versions: 6

Compression:

Stored size: 891 Bytes

Contents

shared_examples_for 'mapper' do |key_map, json_entity_wrapper = nil, json_collection_wrapper = nil, check_constants: true|
  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

6 entries across 6 versions & 1 rubygems

Version Path
fortnox-api-0.5.2 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.5.1 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.5.0 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.4.0 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.3.0 spec/fortnox/api/mappers/examples/mapper.rb
fortnox-api-0.2.0 spec/fortnox/api/mappers/examples/mapper.rb