Sha256: 59a34a807efa1327e965735c2a217a394ea9ec494bf1bef681b5ddefbb3d01a8

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  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.4 spec/unit/veritas/relation/class_methods/new_spec.rb