Sha256: 42b00fbce5b0ff2c601d5b9eac40dbceb771ceff2ac935e75f3e653edbd8ca9e

Contents?: true

Size: 838 Bytes

Versions: 1

Compression:

Stored size: 838 Bytes

Contents

require 'spec_helper'

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

  let(:directions)    { [ :id ]                                  }
  let(:object)        { Relation::Operation::Order::DirectionSet }
  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.2 spec/unit/veritas/relation/operation/order/direction_set/class_methods/coerce_spec.rb