Sha256: f9a9b5b722fee83f22b943875d0bee166b582ca3fa2a1fe8620dede7a21b5317

Contents?: true

Size: 868 Bytes

Versions: 4

Compression:

Stored size: 868 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).and_return(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

4 entries across 4 versions & 1 rubygems

Version Path
veritas-0.0.7 spec/unit/veritas/relation/operation/order/direction/reverse_spec.rb
veritas-0.0.6 spec/unit/veritas/relation/operation/order/direction/reverse_spec.rb
veritas-0.0.5 spec/unit/veritas/relation/operation/order/direction/reverse_spec.rb
veritas-0.0.4 spec/unit/veritas/relation/operation/order/direction/reverse_spec.rb