Sha256: ecdc026f2b75451801d386599baf850b5a91fa4d3496fd204320f19a27a0ba08

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

# encoding: utf-8

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

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

  let(:adapter)  { mock('Adapter')                         }
  let(:relation) { mock('Relation', :restrict => 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#restrict' do
    relation.should_receive(:restrict).with(args)
    subject
  end

  it 'forwards the block to relation#restrict' do
    relation.stub!(:restrict) { |_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/restrict_spec.rb
veritas-do-adapter-0.0.5 spec/unit/veritas/relation/gateway/restrict_spec.rb