Sha256: f8376268650284255b46365d7546f413ebf721c06a68202dca51a9685ba50edc

Contents?: true

Size: 1.46 KB

Versions: 22

Compression:

Stored size: 1.46 KB

Contents

describe Ppl::Application::Output, "#initialize" do

  it "should accept stdout" do
    stdout = Object.new
    @output = Ppl::Application::Output.new(stdout, nil)
    @output.stdout.should be stdout
  end

  it "should accept stderr" do
    stderr = Object.new
    @output = Ppl::Application::Output.new(nil, stderr)
    @output.stderr.should be stderr
  end

end

describe Ppl::Application::Output do

  before(:each) do
    @stderr = double(IO)
    @stdout = double(IO)
    @output = Ppl::Application::Output.new(@stdout, @stderr)
  end

  describe "#error" do
    it "should delegate to stderr's puts method" do
      string = "COMPUTER OVER. VIRUS = VERY YES"
      @stderr.should_receive(:puts).with(string)
      @output.error(string)
    end
  end

  describe "#line" do
    it "should delegate to stdout's puts method" do
      string = "The quick brown fox"
      @stdout.should_receive(:puts).with(string)
      @output.line(string)
    end

    it "should not send carriage returns to stdout" do
      string = "The quick brown fox
"
      @stdout.should_receive(:puts).with("The quick brown fox")
      @output.line(string)
    end

    it "should not send carriage returns to stderr" do
      string = "The quick brown fox
"
      @stderr.should_receive(:puts).with("The quick brown fox")
      @output.error(string)
    end

    it "should not sanitise output if nil" do
      string = nil
      @stdout.should_receive(:puts).with(nil)
      @output.line(string)
    end
  end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ppl-3.0.1 spec/ppl/adapter/output_spec.rb
ppl-3.0.0 spec/ppl/adapter/output_spec.rb
ppl-2.4.1 spec/ppl/adapter/output_spec.rb
ppl-2.4.0 spec/ppl/adapter/output_spec.rb
ppl-2.3.3 spec/ppl/adapter/output_spec.rb
ppl-2.3.2 spec/ppl/adapter/output_spec.rb
ppl-2.3.1 spec/ppl/adapter/output_spec.rb
ppl-2.3.0 spec/ppl/adapter/output_spec.rb
ppl-2.2.0 spec/ppl/adapter/output_spec.rb
ppl-2.1.0 spec/ppl/adapter/output_spec.rb
ppl-2.0.0 spec/ppl/adapter/output_spec.rb
ppl-1.25.0 spec/ppl/adapter/output_spec.rb
ppl-1.24.0 spec/ppl/adapter/output_spec.rb
ppl-1.23.0 spec/ppl/adapter/output_spec.rb
ppl-1.22.2 spec/ppl/adapter/output_spec.rb
ppl-1.22.1 spec/ppl/adapter/output_spec.rb
ppl-1.22.0 spec/ppl/adapter/output_spec.rb
ppl-1.21.0 spec/ppl/adapter/output_spec.rb
ppl-1.20.0 spec/ppl/adapter/output_spec.rb
ppl-1.19.0 spec/ppl/adapter/output_spec.rb