Sha256: 44f55bb0c86138aead6abe19593d9e2c0d3f2128ad86bd374b2a825da1814e86

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Order::Direction, '#reverse' do
  subject { object.reverse }

  let(:described_class) { Class.new(Relation::Operation::Order::Direction) }
  let(:attribute)       { Attribute::Integer.new(:id)                      }
  let(:reverse_class)   { mock('Reverse Class', :new => reverse)           }
  let(:reverse)         { mock('Reverse Instance')                         }
  let(:object)          { described_class.new(attribute)                   }

  before do
    described_class.stub(:reverse => reverse_class)
  end

  it 'calls .reverse on the class' do
    described_class.should_receive(:reverse).with(no_args)
    subject
  end

  it 'calls .new on the reverse class' do
    reverse_class.should_receive(:new).with(attribute)
    subject
  end

  it { should equal(reverse) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

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