spec/unit/veritas/relation/operation/limit/methods/take_spec.rb in veritas-0.0.1 vs spec/unit/veritas/relation/operation/limit/methods/take_spec.rb in veritas-0.0.2
- old
+ new
@@ -1,14 +1,18 @@
require 'spec_helper'
describe 'Veritas::Relation::Operation::Limit::Methods#take' do
- subject { ordered.take(1) }
+ subject { object.take(limit) }
- let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
- let(:ordered) { relation.order { |r| r[:id] } }
+ let(:klass) { Relation }
+ let(:limit) { 1 }
+ let(:relation) { klass.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ].each) }
+ let(:object) { relation.order }
it { should be_kind_of(Relation::Operation::Limit) }
+ its(:limit) { should == limit }
+
it 'behaves the same as Array#take' do
- should == ordered.to_a.take(1)
+ should == object.to_a.take(limit)
end
end