Sha256: 1e7cabd5f7857d8abd9d954955a5852989229b5d021b9d0b30b2b17d3cf11c72

Contents?: true

Size: 1.07 KB

Versions: 87

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

RSpec.describe 'ReeMapper::Bool' do
  link :build_mapper_factory, from: :ree_mapper
  link :build_mapper_strategy, from: :ree_mapper

  let(:mapper_factory) {
    build_mapper_factory(
      strategies: [
        build_mapper_strategy(method: :cast,      dto: Hash),
        build_mapper_strategy(method: :serialize, dto: Hash),
        build_mapper_strategy(method: :db_dump,   dto: Hash),
        build_mapper_strategy(method: :db_load,   dto: Hash)
      ]
    )
  }

  let(:mapper) {
    mapper_factory.call.use(:cast).use(:serialize).use(:db_dump).use(:db_load) {
      any :any
    }
  }

  describe '#serialize' do
    it {
      expect(mapper.serialize({ any: true })).to eq({ any: true })
    }
  end

  describe '#cast' do
    it {
      expect(mapper.cast({ 'any' => true })).to eq({ any: true })
    }
  end

  describe '#db_dump' do
    it {
      expect(mapper.db_dump(OpenStruct.new({ any: true }))).to eq({ any: true })
    }
  end

  describe '#db_load' do
    it {
      expect(mapper.db_load({ 'any' => true })).to eq({ any: true })
    }
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
ree_lib-1.0.124 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.123 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.122 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.121 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.120 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.119 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.118 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.117 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.116 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.115 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.114 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.113 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.112 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.111 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.110 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.109 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.108 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.107 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.106 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.105 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb