Sha256: e74023521f24e97a5b1f3bfba22294a88b4e32b4d93865804eaece637ee87756

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe AutoTagger::Commander do

  describe "#read" do
    it "execute the command and returns the results" do
      commander = AutoTagger::Commander.new("/foo", false)
      commander.should_receive(:`).with("cd /foo && ls")
      commander.read("ls")
    end

    it "puts the response when it's verbose" do
      commander = AutoTagger::Commander.new("/foo", true)
      commander.stub(:`)
      commander.should_receive(:puts).with("cd /foo && ls")
      commander.read("ls")
    end
  end

  describe "#execute" do
    it "executes and doesn't return anything" do
      commander = AutoTagger::Commander.new("/foo", false)
      commander.should_receive(:system).with("cd /foo && ls")
      commander.execute("ls")
    end

    it "puts the response when it's verbose" do
      commander = AutoTagger::Commander.new("/foo", true)
      commander.stub(:system)
      commander.should_receive(:puts).with("cd /foo && ls")
      commander.execute("ls")
    end
  end

  describe "#print" do
    it "returns the command to be run" do
      commander = AutoTagger::Commander.new("/foo", false)
      commander.should_receive(:puts).with("cd /foo && ls")
      commander.print("ls")
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
auto_tagger-0.2.6 spec/auto_tagger/commander_spec.rb
auto_tagger-0.2.5 spec/auto_tagger/commander_spec.rb
auto_tagger-0.2.4 spec/auto_tagger/commander_spec.rb
auto_tagger-0.2.3 spec/auto_tagger/commander_spec.rb
auto_tagger-0.2.2 spec/auto_tagger/commander_spec.rb
auto_tagger-0.2.1 spec/auto_tagger/commander_spec.rb
auto_tagger-0.2.0 spec/auto_tagger/commander_spec.rb