Sha256: 65aaf0a75f50b906e01a8c745b84376152926c2162c51e99b99601a167c0f4b1

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

require 'mattock/remote-command-task'
require 'mattock/bundle-command-task'

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

describe Mattock::RemoteCommandTask do
  include Mattock::RakeExampleGroup
  include Caliph::CommandLineExampleGroup

  let! :remote_task do
    namespace :test do
      Mattock::Rake::RemoteCommandTask.define_task do |t|
        t.remote_server.address = "nowhere.com"
        t.command = t.cmd do |cmd|
          cmd.from("cd", "a_dir")
          cmd &= "ls"
          cmd |= "grep"
          cmd.options << "*.rb"
          cmd.redirect_stderr("/dev/null")
          cmd.redirect_stdout("/tmp/rubyfiles.txt")
        end
        t.verify_command = t.cmd("should_do")
      end
    end
  end

  it "should inspect cleanly" do
    rake["test:run"].inspect.should be_a(String)
  end

  describe "when verification indicates command should proceed" do
    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

describe Mattock::BundleCommandTask do
  include Mattock::RakeExampleGroup
  include Caliph::CommandLineExampleGroup

  let! :bundle_task do
    Mattock::BundleCommandTask.define_task(:bundle_test) do |t|
      t.command = cmd("bundle", "install", "--standalone")
    end
  end

  it "should run command" do
    expect_command(/bundle install/, 0)
    rake["bundle_test"].invoke
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mattock-0.10.1 spec/command-task.rb
mattock-0.10.0 spec/command-task.rb
mattock-0.9.0 spec/command-task.rb
mattock-0.8.0 spec/command-task.rb