Sha256: 19ff4b031235090f1450d03bd665965960d3d3a2fa79aaa155b12cecf9da919f
Contents?: true
Size: 1.67 KB
Versions: 14
Compression:
Stored size: 1.67 KB
Contents
require File.dirname(__FILE__) + '/../lib/spec' require File.dirname(__FILE__) + '/file_accessor' require 'stringio' context "A FileAccessor" do # This sequence diagram illustrates what this spec specifies. # # +--------------+ +----------+ +-------------+ # | FileAccessor | | Pathname | | IoProcessor | # +--------------+ +----------+ +-------------+ # | | | # open_and_handle_with | | | # -------------------->| | open | | # | |--------------->| | | # | | io | | | # | |<...............| | | # | | | process(io) | # | |---------------------------------->| | # | | | | | # | |<..................................| | # | | | # specify "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
14 entries across 14 versions & 1 rubygems