spec/buildbox/buildbox/command_spec.rb in buildbox-0.3.3 vs spec/buildbox/buildbox/command_spec.rb in buildbox-0.3.4

- old
+ new

@@ -43,11 +43,11 @@ result.output.should =~ /(syntax|parse) error/i end it "can collect output in chunks" do chunked_output = '' - result = Buildbox::Command.run('echo', 'hello world') do |command, chunk| + result = Buildbox::Command.run('echo', 'hello world') do |chunk| unless chunk.nil? chunked_output += chunk end end @@ -74,22 +74,22 @@ second_result.output.should =~ /doesntexist.rb:.+not found/ end it "captures color'd output from a command" do chunked_output = '' - result = Buildbox::Command.run('rspec', FIXTURES_PATH.join('rspec', 'test_spec.rb')) do |command, chunk| + result = Buildbox::Command.run('rspec', FIXTURES_PATH.join('rspec', 'test_spec.rb')) do |chunk| chunked_output += chunk unless chunk.nil? end result.exit_status.should == 0 result.output.should include("32m") chunked_output.should include("32m") end it "runs scripts in a tty" do chunked_output = '' - result = Buildbox::Command.run(FIXTURES_PATH.join('tty_script')) do |command, chunk| + result = Buildbox::Command.run(FIXTURES_PATH.join('tty_script')) do |chunk| chunked_output += chunk unless chunk.nil? end result.output.should == "true" result.exit_status.should == 123 @@ -113,13 +113,13 @@ end it "can collect chunks from within a thread" do chunks = [] - result = Buildbox::Command.run(FIXTURES_PATH.join('sleep_script')) do |command, chunk| + result = Buildbox::Command.run(FIXTURES_PATH.join('sleep_script')) do |chunk| chunks << chunk end - chunks.should == ["test 0\r\n", "test 1\r\n", "test 2\r\n"] + chunks.map(&:chomp).reject(&:empty?).should == ["test 0", "test 1", "test 2"] end end end