Sha256: b34d7b49184c0c8f1963948b25d58110f209481eb7e62ffb53beb126e59e3483

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

require 'spec_helper'

RSpec.describe Cache::Object::InstanceDecorator do
  let(:decorator) { Cache::Object::InstanceDecorator.new(instance, mappings) }

  describe '#keys' do
    let(:instance) { double(id: 1, user_id: 11, sex: 'male', class: double(name: 'User')) }
    let(:mappings) { [[:user_id] , [:user_id, :sex]] }

    it 'includes the keys based on the mappings' do
      expect(decorator.keys).to include 'User-user_id-11'
      expect(decorator.keys).to include 'User-user_id-11-sex-male'
    end

    it 'includes the canonical id key' do
      expect(decorator.keys).to include 'User-1'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cache-object-0.0.2 spec/cache/object/instance_decorator_spec.rb
cache-object-0.0.1 spec/cache/object/instance_decorator_spec.rb