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.84 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.83 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.82 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.81 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.80 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.79 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.78 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.77 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.76 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.75 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.74 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.73 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.72 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.71 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.70 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.69 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.68 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.67 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.66 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb
ree_lib-1.0.65 lib/ree_lib/packages/ree_mapper/spec/ree_mapper/types/any_spec.rb