Sha256: 4d10345e7b9d38b970ff42e4f20d84aaaddb0f423915d587c8207ca81ffc8a7e
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
# encoding: utf-8 require 'spec_helper' describe SQL::Generator::Relation, '#visit' do subject { object.visit(visitable) } let(:described_class) { Class.new(SQL::Generator::Relation) } let(:object) { described_class.new } context 'with a handled object' do let(:visitable) { mock('Visitable') } before do described_class.class_eval do def visit_spec_mocks_mock(mock) mock end end end it_should_behave_like 'a command method' specify { expect { subject }.to change(object, :frozen?).from(false).to(true) } end context 'with a handled object more than once' do let(:visitable) { mock('Visitable') } before do described_class.class_eval do def visit_spec_mocks_mock(mock) mock end end end before do object.visit(visitable) end if RUBY_VERSION >= '1.9' specify { expect { subject }.to raise_error(RuntimeError) } else specify { expect { subject }.to raise_error(TypeError) } end end context 'with an unhandled object' do let(:visitable) { mock('Not Handled') } specify { expect { subject }.to raise_error(SQL::Generator::Visitor::UnknownObject, "No handler for #{visitable.class} in #{object.class}") } end end
Version data entries
5 entries across 5 versions & 1 rubygems