Sha256: ef9f70a99b958d786e4437474723baecad93aefdfd222178562cdd7e01e14515

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Order::DirectionSet, '.coerce' do
  subject { object.coerce(argument) }

  let(:directions)    { [ :id ]                }
  let(:object)        { described_class        }
  let(:direction_set) { object.new(directions) }

  context 'when the argument is a DirectionSet' do
    let(:argument) { direction_set }

    it { should equal(argument) }
  end

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

    it { should be_kind_of(object) }

    it { should == direction_set }
  end

  context 'when the argument is not a DirectionSet 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/operation/order/direction_set/class_methods/coerce_spec.rb