Sha256: 9ef4b85106a1b65db4ed71a1cff77e237d5d360c7e45e816f4b0c0bb9f869069

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 Bytes

Contents

# encoding: utf-8

require 'spec_helper'
require 'veritas/relation/gateway'

describe Relation::Gateway, '#sort_by' do
  subject { object.sort_by(args, &block) }

  let(:adapter)  { mock('Adapter')                         }
  let(:relation) { mock('Relation', :sort_by => response)  }
  let(:response) { mock('New Relation', :kind_of? => true) }
  let!(:object)  { described_class.new(adapter, relation)  }
  let(:args)     { stub                                    }
  let(:block)    { proc {}                                 }

  it_should_behave_like 'a unary relation method'

  it 'forwards the arguments to relation#sort_by' do
    relation.should_receive(:sort_by).with(args)
    subject
  end

  it 'forwards the block to relation#sort_by' do
    relation.stub!(:sort_by) { |_args, proc| proc.should equal(block) }
    subject
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritas-do-adapter-0.0.6 spec/unit/veritas/relation/gateway/sort_by_spec.rb
veritas-do-adapter-0.0.5 spec/unit/veritas/relation/gateway/sort_by_spec.rb