Sha256: f82a6c120479cd7c0db908cdeeedd5284f9f522a81d2319e977d25eda94e68d1

Contents?: true

Size: 595 Bytes

Versions: 5

Compression:

Stored size: 595 Bytes

Contents

require './lib/couchbase-orm/active_record_compat'

class Foo
  include CouchbaseOrm::ActiveRecordCompat

  def compute_age
    10 + 32
  end
end

describe CouchbaseOrm::ActiveRecordCompat do
  let(:foo) { Foo.new }
  describe '#slice' do
    it 'creates a hash with method names as keys and results as values' do
      expect(foo.slice(:compute_age).to_h).to eq(HashWithIndifferentAccess.new({ compute_age: 42 }))
    end
  end

  describe '#values_at' do
    it 'creates an array of results from given method names' do
      expect(foo.values_at([:compute_age])).to eq([42])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
couchbase-orm-2.0.4 spec/couchbase-orm/active_record_compat_spec.rb
couchbase-orm-2.0.3 spec/couchbase-orm/active_record_compat_spec.rb
couchbase-orm-2.0.2 spec/couchbase-orm/active_record_compat_spec.rb
couchbase-orm-2.0.1 spec/couchbase-orm/active_record_compat_spec.rb
couchbase-orm-2.0.0 spec/couchbase-orm/active_record_compat_spec.rb