Sha256: d73db3d97e00b0a7d492891eada74e8e18d4cd99ff9f348680b55f6653bea7c3

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Header, '.coerce' do
  subject { object.coerce(argument) }

  let(:object) { described_class }

  context 'when the argument is a Header' do
    let(:argument) { object.new([ [ :id, Integer ] ]) }

    it { should equal(argument) }
  end

  context 'when the argument responds to #to_ary' do
    let(:argument) { [ [ :id, Integer ] ] }

    it { should be_kind_of(object) }

    it { should == argument }
  end

  context 'when the argument is not a Header and does not respond to #to_ary' do
    let(:argument) { { :id => Integer } }

    specify { expect { subject }.to raise_error(NoMethodError) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.4 spec/unit/veritas/relation/header/class_methods/coerce_spec.rb