Sha256: 8100b231a575f804e6aead7e4888921a7cf63106ce5dc62d5308a3a87b5f7f34

Contents?: true

Size: 1.19 KB

Versions: 6

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe Aruba::Api  do

  before(:each) do
    klass = Class.new {
      include Aruba::Api

      def set_tag(tag_name, value)
        self.instance_variable_set "@#{tag_name.to_s}", value
      end

      def announce_or_puts(*args)
        p caller[0..2]
      end
    }
    @aruba = klass.new
  end

  describe 'current_dir' do
    it "should return the current dir as 'tmp/aruba'" do
      @aruba.current_dir.should match(/^tmp\/aruba$/)
    end
  end

  describe 'tags' do
    describe '@announce_stdout' do

      context 'enabled' do
        it "should announce to stdout exactly once" do
          @aruba.should_receive(:announce_or_puts).once
          @aruba.set_tag(:announce_stdout, true)
          @aruba.run_simple("ruby -e 'puts \"hello world\"'", false)
          @aruba.all_output.should match(/hello world/)
        end
      end

      context 'disabled' do
        it "should not announce to stdout" do
          @aruba.should_not_receive(:announce_or_puts)
          @aruba.set_tag(:announce_stdout, false)
          @aruba.run_simple("ruby -e 'puts \"hello world\"'", false)
          @aruba.all_output.should match(/hello world/)
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/aruba-0.4.11/spec/aruba/api_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/aruba-0.4.11/spec/aruba/api_spec.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/aruba-0.4.11/spec/aruba/api_spec.rb
ftl-0.2.0 vendor/bundle/gems/aruba-0.4.11/spec/aruba/api_spec.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/aruba-0.4.11/spec/aruba/api_spec.rb
aruba-0.4.11 spec/aruba/api_spec.rb