Sha256: e18bd5723b8a69921a34d1281b4aba4ec85f2bf45ec58f212ead387edfd05f40

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:object) { described_class.coerce([ header ]) }
  let(:header) { [ [ :id ] ]                        }
  let(:yields) { []                                 }

  it_should_behave_like 'an #each method'

  it 'yields only headers' do
    subject
    yields.each { |header| header.should be_instance_of(Relation::Header) }
  end

  it 'yields only headers with the expected data' do
    expect { subject }.to change { yields.dup }.
      from([]).
      to([ header ])
  end
end

describe Relation::Keys 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/keys/each_spec.rb