Permalink
Browse files

helps to refactor the test to handle print vs puts

  • Loading branch information...
1 parent 85aefca commit 4bbc20bccb0ad520962303bc5ce91704cd904057 @wbailey committed Jun 1, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 spec/command/initialize_spec.rb
@@ -5,16 +5,18 @@
let(:config) { 'test/.test.yml' }
- it 'works' do
+ it 'creates the configuration file' do
+ fh = double( File, :write => true )
+
File.should_receive(:join).and_return(config)
File.should_receive(:exists?).and_return(false)
- subject.should_receive(:puts)
- fh = double( File, :write => true )
+ subject.should_receive(:print)
File.should_receive(:open).with(config, 'w').and_return(fh)
- subject.should_receive(:puts)
+ fh.should_receive(:write)
+ subject.should_receive(:puts)
subject.should_receive(:exit).with(0)
subject.exec

0 comments on commit 4bbc20b

Please sign in to comment.