Sha256: a4905475ea9a09cb0b731d40b8a16732bd75e711ca1b2458d3c0dd560c874312

Contents?: true

Size: 929 Bytes

Versions: 2

Compression:

Stored size: 929 Bytes

Contents

require 'spec_helper'

describe Ridley::Mixin::ShellOut do
  describe "shell_out" do
    let(:command) { "ls" }

    subject(:result) { described_class.shell_out(command) }

    it "returns a ShellOut::Response" do
      expect(result).to be_a(described_class::Response)
    end

    its(:stdout) { should be_a(String) }
    its(:stderr) { should be_a(String) }
    its(:exitstatus) { should be_a(Fixnum) }
    its(:success?) { should be_true }
    its(:error?) { should be_false }

    context "when on MRI" do
      before { described_class.stub(jruby?: false) }

      it "delegates to #mri_out" do
        described_class.should_receive(:mri_out).with(command)
        result
      end
    end

    context "when on JRuby" do
      before { described_class.stub(jruby?: true) }

      it "delegates to #jruby_out" do
        described_class.should_receive(:jruby_out).with(command)
        result
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ridley-1.0.3 spec/unit/ridley/mixin/shell_out_spec.rb
ridley-1.0.2 spec/unit/ridley/mixin/shell_out_spec.rb