Sha256: 04acdce0e4e4abd2851ea73fcd1e3008b3a38e72dcb27a989f03b04f9df13d7a

Contents?: true

Size: 710 Bytes

Versions: 2

Compression:

Stored size: 710 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Limit::Methods, '#take' do
  subject { object.take(limit) }

  let(:described_class) { Relation                                                              }
  let(:limit)           { 1                                                                     }
  let(:relation)        { described_class.new([[:id, Integer]], LazyEnumerable.new([[1], [2]])) }
  let(:object)          { relation.sort_by { |r| r.id }                                         }

  it { should be_instance_of(Relation::Operation::Limit) }

  its(:limit) { should == limit }

  it 'behaves the same as Array#take' do
    should == object.to_a.take(limit)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
axiom-0.2.0 spec/unit/axiom/relation/operation/limit/methods/take_spec.rb
axiom-0.1.1 spec/unit/axiom/relation/operation/limit/methods/take_spec.rb