Sha256: 2fc9ea21715ea0a6e05ecd66e95caabd5dc653f67d11e4d154c98eee2ed6d384
Contents?: true
Size: 968 Bytes
Versions: 8
Compression:
Stored size: 968 Bytes
Contents
require "metamorpher/visitable/visitor" module Metamorpher module Visitable describe Visitor do it "should call visitor based on the type of the visitee" do allow(subject).to receive(:visit_string) subject.visit("foo") expect(subject).to have_received(:visit_string) end it "should call visitor on ancestor of visitee if necessary" do allow(subject).to receive(:visit_numeric) subject.visit(3) # Fixnum < Integer < Numeric expect(subject).to have_received(:visit_numeric) end it "should call visitor based on unqualified type of the visitee" do allow(subject).to receive(:visit_dummy) subject.visit(Dummy.new) expect(subject).to have_received(:visit_dummy) end it "should raise if no appropriate visit method is defined" do expect { subject.visit("foo") }.to raise_error(ArgumentError) end end class Dummy; end end end
Version data entries
8 entries across 8 versions & 1 rubygems