Sha256: 6c26be2a593ad9858a221ee413f0789639429bd8c56c7e0cfb8a1cdf898f8ce5
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
# encoding: utf-8 require 'spec_helper' require 'axiom/adapter/data_objects/statement' describe Adapter::DataObjects::Statement, '#to_s' do subject { object.to_s } let(:sql) { double('SQL') } let(:connection) { double } let(:relation) { double('Relation') } let(:generator) { double('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 allow(visitor).to receive(: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 expect(visitor).to receive(:visit).with(relation) subject end end context 'with a visitor' do let(:visitor) { double('Visitor', visit: generator) } let(:object) { described_class.new(connection, relation, visitor) } before do allow(visitor).to receive(: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 expect(visitor).to receive(:visit).with(relation) subject end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-do-adapter-0.2.0 | spec/unit/axiom/adapter/data_objects/statement/to_s_spec.rb |