Sha256: 4dc72091bca60eb5a6fe5dbadee6b1b9c7c4d9dc416ca782e9828d34f17e7194

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'
module Alf
  module Command
    describe DocManager, ".call" do

      let(:dm){ @dm ||= DocManager.new }
      let(:cmd){ Alf::Command::Show }
      subject{ 
        dm.call(cmd, opts) 
      }

      describe "without options" do
        let(:opts){ {} }

        describe "on a static file" do
          before{ 
            def dm.find_file(cmd); 
              File.expand_path('../static.md', __FILE__)
            end 
          }
          it { should eq("Hello\n") }
        end

        describe "on a dynamic file" do
          before{ 
            def dm.find_file(cmd); 
              File.expand_path('../dynamic.md', __FILE__)
            end 
          }
          it { should eq("show\n") }
        end

        unless RUBY_VERSION < "1.9"
          describe "on an example file" do
            before{ 
              def dm.find_file(cmd); 
                File.expand_path('../example.md', __FILE__)
              end 
            }
            it { should eq(File.read(File.expand_path('../example_1.txt', __FILE__))) }
          end
        end

      end


    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-0.10.1 spec/unit/command/doc_manager/test_call.rb
alf-0.10.0 spec/unit/command/doc_manager/test_call.rb