Sha256: 1cfbe5b345e0d55c698df5a102e1c00e97b5781b04e108d8dac4c91a4d362320

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Header, '#each' do
  subject { object.each { |tuple| yields << tuple } }

  let(:attribute) { Attribute::Integer.new(:id)      }
  let(:object)    { described_class.new([attribute]) }
  let(:yields)    { []                               }

  it_should_behave_like 'an #each method'

  it 'yields only attributes' do
    subject
    yields.each { |attribute| attribute.should be_kind_of(Attribute) }
  end

  it 'yields each attribute' do
    expect { subject }.to change { yields.dup }
      .from([])
      .to([attribute])
  end
end

describe Relation::Header do
  subject { object.new }

  let(:object) { described_class }

  it { should be_kind_of(Enumerable) }

  it 'case matches Enumerable' do
    (Enumerable === subject).should be(true)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.1 spec/unit/axiom/relation/header/each_spec.rb