Sha256: 0672e79587a0ca189ef578ad65fa990246fbb6c5073195aa437428186e321be0

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Relation.new' do
  subject { object.new(header, body) }

  let(:header) { Relation::Header.new([ [ :id, Integer ] ]) }
  let(:object) { Relation                                   }

  context 'with an Enumerable responding to #size' do
    let(:body) { [ [ 1 ] ] }

    before do
      body.should respond_to(:size)
    end

    it { should be_kind_of(Relation::Materialized) }

    it { should == body }
  end

  context 'with an Enumerable that does not respond to #size' do
    let(:body) { [ [ 1 ] ].each }  # use an Enumerator

    before do
      body.should_not respond_to(:size)
    end

    it { should be_kind_of(object) }

    it { should == [ [ 1 ] ] }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/relation/class_methods/new_spec.rb