Sha256: 2b5cf13afe9160fbdfb704ade419cb29efc8ad938ee7a87ad49cd07c32b0cf17

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:object)    { Class.new(described_class)  }
  let(:attribute) { Attribute::Integer.new(:id) }

  context 'when the argument is a Direction' do
    let(:argument) { Relation::Operation::Order::Ascending.new(attribute) }

    it { should equal(argument) }
  end

  context 'when the argument is an Attribute' do
    let(:argument) { attribute }

    it { should be_instance_of(object) }

    its(:attribute) { should equal(attribute) }
  end

  context 'when the argument is an Array' do
    let(:argument) { [ :id, Integer ] }

    it { should be_instance_of(object) }

    its(:attribute) { should eql(attribute) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/relation/operation/order/direction/class_methods/coerce_spec.rb