Sha256: 5193354a5147c03bcb0bb33a3b9e412e417d18abd94f25bf97d32ba9d70d2686

Contents?: true

Size: 1.17 KB

Versions: 20

Compression:

Stored size: 1.17 KB

Contents

require 'mattock/remote-command-task'
require 'mattock/testing/rake-example-group'
require 'mattock/testing/mock-command-line'

describe Mattock::RemoteCommandTask do
  include Mattock::RakeExampleGroup
  let! :remote_task do
    namespace :test do
      Mattock::RemoteCommandTask.new do |t|
        t.remote_server.address = "nowhere.com"
        t.command = Mattock::PrereqChain.new do |prereq|
          prereq.add Mattock::CommandLine.new("cd", "a_dir")
          prereq.add Mattock::PipelineChain.new do |pipe|
            pipe.add Mattock::CommandLine.new("ls")
            pipe.add Mattock::CommandLine.new("grep") do |cmd|
              cmd.options << "*.rb"
              cmd.redirect_stderr("/dev/null")
              cmd.redirect_stdout("/tmp/rubyfiles.txt")
            end
          end
        end
        t.verify_command = Mattock::CommandLine.new("should_do")
      end
    end
  end

  describe "when verification indicates command should proceed" do
    include Mattock::CommandLineExampleGroup

    it "should run both commands" do
      expect_command(/should_do/, 1)
      expect_command(/^ssh.*cd.*ls.*grep.*rubyfiles.txt/, 0)

      rake["test:run"].invoke
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
mattock-0.3.1 spec/command-task.rb
mattock-0.3.0 spec/command-task.rb
mattock-0.2.13 spec/command-task.rb
mattock-0.2.12 spec/command-task.rb
mattock-0.2.11 spec/command-task.rb
mattock-0.2.10 spec/command-task.rb
mattock-0.2.9 spec/command-task.rb
mattock-0.2.8 spec/command-task.rb
mattock-0.2.7 spec/command-task.rb
mattock-0.2.6 spec/command-task.rb
mattock-0.2.5 spec/command-task.rb
mattock-0.2.4 spec/command-task.rb
mattock-0.2.3 spec/command-task.rb
mattock-0.2.2 spec/command-task.rb
mattock-0.2.1 spec/command-task.rb
mattock-0.2.0 spec/command-task.rb
mattock-0.1.3 spec/command-task.rb
mattock-0.1.2 spec/command-task.rb
mattock-0.1.1 spec/command-task.rb
mattock-0.1.0 spec/command-task.rb