Sha256: 6bda2ed5c020febf2d3a5b389c899e8985f5cf7459076c3bb56cd7fa5d04fe94
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'veritas/adapter/data_objects/statement' describe Adapter::DataObjects::Statement, '#to_s' do subject { object.to_s } let(:sql) { mock('SQL') } let(:connection) { stub } let(:relation) { mock('Relation') } let(:generator) { mock('Generator', :to_sql => sql) } context 'without a visitor' do let(:visitor) { SQL::Generator::Relation } # default visitor let(:object) { described_class.new(connection, relation) } before do visitor.stub!(:visit).and_return(generator) end it_should_behave_like 'an idempotent method' it { should be_frozen } it { should equal(sql) } it 'visits the relation' do visitor.should_receive(:visit).with(relation) subject end end context 'with a visitor' do let(:visitor) { mock('Visitor', :visit => generator) } let(:object) { described_class.new(connection, relation, visitor) } before do visitor.stub!(:visit).and_return(generator) end it_should_behave_like 'an idempotent method' it { should be_frozen } it { should equal(sql) } it 'visits the relation' do visitor.should_receive(:visit).with(relation) subject end end end
Version data entries
3 entries across 3 versions & 1 rubygems