Sha256: 4a79de09de8e9a8ff03a9412cceda1df55a6eed5466c019edb3560de17d17247

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe "Cmds.out" do
  it "gets echo output" do
    expect( Cmds.out "echo %s", "hey there!" ).to eq "hey there!\n"
  end

  it "reads input" do
    expect(
      Cmds.out("ruby -e %{script}", script: "puts STDIN.read") {
        "hey there!"
      }
    ).to eq "hey there!\n"
  end
end # Cmds.out

describe "Cmds.out!" do
  it "gets echo output" do
    expect( Cmds.out! "echo %s", "hey there!" ).to eq "hey there!\n"
  end

  it "reads input" do
    expect(
      Cmds.out!("ruby -e %{script}", script: "puts STDIN.read") {
        "hey there!"
      }
    ).to eq "hey there!\n"
  end

  it "errors when the command fails" do
    expect { Cmds.out! "false" }.to raise_error SystemCallError
  end
end # Cmds.out!

describe "Cmds#out" do
  it "gets echo output" do
    expect( Cmds.new("echo %s").out "hey there!" ).to eq "hey there!\n"
  end

  it "reads input" do
    expect(
      Cmds.new("ruby -e %{script}").out(script: "puts STDIN.read") {
        "hey there!"
      }
    ).to eq "hey there!\n"
  end
end # Cmds#out

describe "Cmds#out!" do
  it "gets echo output" do
    expect( Cmds.new("echo %s").out! "hey there!" ).to eq "hey there!\n"
  end

  it "reads input" do
    expect(
      Cmds.new("ruby -e %{script}").out!(script: "puts STDIN.read") {
        "hey there!"
      }
    ).to eq "hey there!\n"
  end

  it "errors when the command fails" do
    expect { Cmds.new("false").out! }.to raise_error SystemCallError
  end
end # Cmds#out!

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cmds-0.2.11 spec/cmds/out_spec.rb
cmds-0.2.10 spec/cmds/out_spec.rb
cmds-0.2.9 spec/cmds/out_spec.rb
cmds-0.2.8 spec/cmds/out_spec.rb
cmds-0.2.7 spec/cmds/out_spec.rb
cmds-0.2.6 spec/cmds/out_spec.rb
cmds-0.2.5 spec/cmds/out_spec.rb
cmds-0.2.4 spec/cmds/out_spec.rb
cmds-0.2.3 spec/cmds/out_spec.rb
cmds-0.2.2 spec/cmds/out_spec.rb
cmds-0.2.1 spec/cmds/out_spec.rb
cmds-0.2.0 spec/cmds/out_spec.rb