public
Description: A process execution library which doesn't suck.
Clone URL: git://github.com/codahale/ropen.git
codahale (author)
Thu May 15 14:27:52 -0700 2008
commit  04fc99c893e0666254071fbee53be27206aa8652
tree    1501aeac87ad288620772e0c7546fb4fa86b5a19
parent  b18d73130f5f0562b5085cab15fd17c262964868
ropen / spec / ropen / spool_spec.rb
100644 26 lines (19 sloc) 0.633 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require File.join(File.dirname(__FILE__), "..", "spec_helper")
 
require "ropen/spool"
 
describe Ropen::Spool do
  
  before(:each) do
    @spool = Ropen::Spool.new
    @stream = mock(:stream)
  end
  
  it "should collect messages and replay them on an object once" do
    block = lambda { @stream.do_it }
    @spool.puts "I'm a message."
    @spool.close
    @spool.run_this_thing(&block)
    
    @stream.should_receive(:puts).with("I'm a message.")
    @stream.should_receive(:close)
    @stream.should_receive(:do_it)
    @stream.should_receive(:run_this_thing).with(&block).and_yield
    
    @spool.replay(@stream)
  end
  
end