Sha256: bb460cdc630cc51ee2c9e954eb46abb7c44d72c2210d0232528daaa4f1291d0c

Contents?: true

Size: 680 Bytes

Versions: 1

Compression:

Stored size: 680 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:object) { described_class }

  context 'when the arguments are Keys' do
    let(:argument) { object.new([ [ [ :id ] ] ]) }

    it { should equal(argument) }
  end

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

    it { should be_instance_of(object) }

    it { should == [ Relation::Header.coerce([ :id ]) ] }
  end

  context 'when the argument is not a Keys and does not respond to #to_ary' do
    let(:argument) { Object.new }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/relation/keys/class_methods/coerce_spec.rb