Sha256: f8c3b5800ea399a0e97df57d57a73fff5544ac34303f190c7235a44950ef254e

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 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.0 spec/unit/axiom/relation/header/each_spec.rb