Sha256: 4155714809cbe53ce90d55420f85d885c31f4c5018277351cad4e3e6f20f31ec

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

RSpec.describe TTY::Command, '#ruby' do
  it "runs ruby with a single string argument" do
    output = StringIO.new
    cmd = TTY::Command.new(output: output)
    out, err = cmd.ruby %q{-e "puts 'Hello World'"}
    expect(out.chomp).to eq("Hello World")
    expect(err).to be_empty unless jruby?
  end

  it "runs ruby with multiple arguments" do
    output = StringIO.new
    cmd = TTY::Command.new(output: output)
    result = double(:success? => true)
    allow(cmd).to receive(:run).with(TTY::Command::RUBY,
      'script.rb', 'foo', 'bar', {}).and_return(result)
    expect(cmd.ruby('script.rb', 'foo', 'bar')).to eq(result)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tty-command-0.9.0 spec/unit/ruby_spec.rb