From 702534e1145ec2423510d47aff75dbc142356342 Mon Sep 17 00:00:00 2001 From: Loren Segal Date: Wed, 30 May 2012 16:34:25 -0400 Subject: [PATCH] Add test to yri to ensure serialization occurs --- spec/cli/yri_spec.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spec/cli/yri_spec.rb b/spec/cli/yri_spec.rb index 1b14f3a36..496d5890d 100644 --- a/spec/cli/yri_spec.rb +++ b/spec/cli/yri_spec.rb @@ -1,12 +1,14 @@ require File.dirname(__FILE__) + '/../spec_helper' -class YARD::CLI::YRI +class TestYRI < YARD::CLI::YRI public :optparse, :find_object, :cache_object + def test_stub; end + def print_object(*args) test_stub; super end end describe YARD::CLI::YRI do before do - @yri = YARD::CLI::YRI.new + @yri = TestYRI.new Registry.stub!(:load) end @@ -85,5 +87,13 @@ class YARD::CLI::YRI @yri.should_receive(:exit).with(1) @yri.run('Foo') end + + it "should ensure output is serialized" do + obj = YARD::CodeObjects::ClassObject.new(:root, 'Foo') + class << @yri + def test_stub; @serializer.should_receive(:serialize).once end + end + @yri.run('Foo') + end end end