Sha256: 375fd19be927e9f8e1f2aa9b39d1fbeea8cd1d041c93fa40aa1be4c9a87ca906

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 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 be(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.1 spec/unit/axiom/relation/keys/class_methods/coerce_spec.rb