Sha256: 59aafc0c6bc9b0f4645f3c8d14cf7891132010e3a78de4620b416548380ac8e4
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Relation, '.new' do subject { object.new(header, body) } let(:header) { Relation::Header.coerce([ [ :id, Integer ] ]) } let(:object) { described_class } let(:body) { [ [ 1 ] ] } context 'with an Enumerable responding to #size' do it { should be_instance_of(Relation::Materialized) } it { should == body.dup } it 'does not freeze the body' do body.should_not be_frozen expect { subject }.to_not change(body, :frozen?) end end context 'with an Enumerable that returns nil for #size' do before do body.should_receive(:size).and_return(nil) end it { should be_instance_of(object) } it { should == body.dup } it 'does not freeze the body' do body.should_not be_frozen expect { subject }.to_not change(body, :frozen?) end end context 'with an Enumerable that returns Float::INFINITY for #size' do before do body.should_receive(:size).and_return(Float::INFINITY) end it { should be_instance_of(object) } it { should == body.dup } it 'does not freeze the body' do body.should_not be_frozen expect { subject }.to_not change(body, :frozen?) end end context 'with an Enumerable that does not respond to #size' do before do class << body undef_method(:size) end end it { should be_instance_of(object) } it { should == body.dup } it 'does not freeze the body' do body.should_not be_frozen expect { subject }.to_not change(body, :frozen?) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/relation/class_methods/new_spec.rb |