Sha256: ce765eebcd8ad73b9d0f16ebca41f8925b6795004437f6e892e93f1772fdf394

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 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 be(argument) }
  end

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

    it { should be_instance_of(object) }

    its(:attribute) { should be(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.1 spec/unit/axiom/relation/operation/order/direction/class_methods/coerce_spec.rb