Sha256: 0ada146c912b10e98b3ad95e16cd60db008cafd71e97b49b989c8db4936ad1ef

Contents?: true

Size: 1.46 KB

Versions: 59

Compression:

Stored size: 1.46 KB

Contents

require File.expand_path("../base", __FILE__)
require "acceptance/support/matchers/have_color"

describe "vagrant and color output" do
  include_context "acceptance"

  # This is a check to see if the `expect` program is installed on this
  # computer. Some tests require this and if this doesn't exist then the
  # test itself will be skipped.
  def self.has_expect?
    `which expect`
    $?.success?
  end

  it "outputs color if there is a TTY", :if => has_expect? do
    environment.workdir.join("color.exp").open("w+") do |f|
      f.puts(<<-SCRIPT)
spawn #{environment.replace_command("vagrant")} status
expect default {}
SCRIPT
    end

    result = execute("expect", "color.exp")
    result.stdout.should have_color
  end

  it "doesn't output color if there is a TTY but --no-color is present", :if => has_expect? do
    environment.workdir.join("color.exp").open("w+") do |f|
      f.puts(<<-SCRIPT)
spawn #{environment.replace_command("vagrant")} status --no-color
expect default {}
SCRIPT
    end

    result = execute("expect", "color.exp")
    result.stdout.should_not have_color
  end

  it "doesn't output color in the absense of a TTY" do
    # This should always output an error, which on a TTY would
    # output color. We check that this doesn't output color.
    # If `vagrant status` itself is broken, another acceptance test
    # should catch that. We just assume it works here.
    result = execute("vagrant", "status")
    result.stdout.should_not have_color
  end
end

Version data entries

59 entries across 59 versions & 11 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/test/acceptance/vagrant_test.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/test/acceptance/vagrant_test.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/vagrant_test.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/test/acceptance/vagrant_test.rb
bmhatfield-vagrant-1.0.10 test/acceptance/vagrant_test.rb
bmhatfield-vagrant-1.0.9 test/acceptance/vagrant_test.rb
tnargav-1.3.6 test/acceptance/vagrant_test.rb
tnargav-1.3.3 test/acceptance/vagrant_test.rb
bmhatfield-vagrant-1.0.8 test/acceptance/vagrant_test.rb
vagrant-shell-0.2.9 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/vagrant_test.rb
tnargav-1.2.3 test/acceptance/vagrant_test.rb
vagrant-shell-0.2.8 demo/templates/vendor/bundle/ruby/1.9.1/gems/tnargav-1.2.2/test/acceptance/vagrant_test.rb
bmhatfield-vagrant-1.0.7 test/acceptance/vagrant_test.rb
vagrant-shell-0.2.6 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/vagrant_test.rb
vagrant-shell-0.2.5 vendor/bundle/gems/tnargav-1.2.2/test/acceptance/vagrant_test.rb
tnargav-1.2.2 test/acceptance/vagrant_test.rb
vagrantup-1.1.3 test/acceptance/vagrant_test.rb
vagrantup-1.1.2 test/acceptance/vagrant_test.rb
vagrantup-1.1.1 test/acceptance/vagrant_test.rb
vagrantup-1.1.0 test/acceptance/vagrant_test.rb