Skip to content

Commit

Permalink
CI: Fixed #run_command spec on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrasimplicity authored and mvz committed Mar 17, 2024
1 parent 8546717 commit 164530b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions spec/aruba/api/commands_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
include_context "uses aruba API"

describe "#run_command" do
let(:cmd) { 'ruby -ne "puts $_"' }

context "when succesfully running a command" do
before { @aruba.run_command "cat" }
before { @aruba.run_command cmd }

after { @aruba.all_commands.each(&:stop) }

Expand All @@ -33,6 +35,15 @@
@aruba.write_file(@file_name, "Hello\nWorld!")
@aruba.pipe_in_file(@file_name)
@aruba.close_input

@aruba.last_command_started.stop
last_command_output = @aruba.last_command_started.output

# Convert \r\n to \n, if present in the output
if last_command_output.include?("\r\n")
allow(@aruba.last_command_started).to receive(:output).and_return(last_command_output.gsub("\r\n", "\n"))
end

expect(@aruba.last_command_started).to have_output "Hello\nWorld!"
end
end
Expand All @@ -47,7 +58,7 @@
end

it "raises an error" do
expect { @aruba.run_command "cat" }.to raise_error NotImplementedError
expect { @aruba.run_command cmd }.to raise_error NotImplementedError
end
end

Expand Down

0 comments on commit 164530b

Please sign in to comment.