Sha256: b04388b3dec0f9d82df315322f862c373379308fd6ad91451bfe376632c55850
Contents?: true
Size: 1.63 KB
Versions: 117
Compression:
Stored size: 1.63 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' require File.dirname(__FILE__) + '/file_accessor' require 'stringio' describe "A FileAccessor" do # This sequence diagram illustrates what this spec specifies. # # +--------------+ +----------+ +-------------+ # | FileAccessor | | Pathname | | IoProcessor | # +--------------+ +----------+ +-------------+ # | | | # open_and_handle_with | | | # -------------------->| | open | | # | |--------------->| | | # | | io | | | # | |<...............| | | # | | | process(io) | # | |---------------------------------->| | # | | | | | # | |<..................................| | # | | | # it "should open a file and pass it to the processor's process method" do # This is the primary actor accessor = FileAccessor.new # These are the primary actor's neighbours, which we mock. file = mock "Pathname" io_processor = mock "IoProcessor" io = StringIO.new "whatever" file.should_receive(:open).and_yield io io_processor.should_receive(:process).with(io) accessor.open_and_handle_with(file, io_processor) end end
Version data entries
117 entries across 117 versions & 14 rubygems