Sha256: b78e125fbb034ea6a2c2f5ca1cd5ef88edc092759c8141863ebba42bd18be22f

Contents?: true

Size: 1.26 KB

Versions: 99

Compression:

Stored size: 1.26 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Thor::Shell::Color do
  def shell
    @shell ||= Thor::Shell::Color.new
  end

  describe "#say" do
    it "set the color if specified" do
      $stdout.should_receive(:puts).with("\e[32mWow! Now we have colors!\e[0m")
      shell.say "Wow! Now we have colors!", :green
    end

    it "does not use a new line even with colors" do
      $stdout.should_receive(:print).with("\e[32mWow! Now we have colors! \e[0m")
      shell.say "Wow! Now we have colors! ", :green
    end
  end

  describe "#say_status" do
    it "uses color to say status" do
      $stdout.should_receive(:puts).with("\e[1m\e[31m    conflict\e[0m  README")
      shell.say_status :conflict, "README", :red
    end
  end

  describe "#file_collision" do
    describe "when a block is given" do
      it "invokes the diff command" do
        $stdout.stub!(:print)
        $stdin.should_receive(:gets).and_return('d')
        $stdin.should_receive(:gets).and_return('n')

        output = capture(:stdout){ shell.file_collision('spec/fixtures/doc/README'){ "README\nEND\n" } }
        output.should =~ /\e\[31m\- __start__\e\[0m/
        output.should =~ /^  README/
        output.should =~ /\e\[32m\+ END\e\[0m/
      end
    end
  end
end

Version data entries

99 entries across 94 versions & 12 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.7.5 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.7.4 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.7.3 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/thor-0.14.6/spec/shell/color_spec.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/thor-0.14.6/spec/shell/color_spec.rb
wijet-thor-0.14.10 spec/shell/color_spec.rb
classiccms-0.7.2 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.7.1 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.7.0 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
wijet-thor-0.14.9 spec/shell/color_spec.rb
classiccms-0.6.9 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.8 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.7 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.6 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.5 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.4 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.3 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.2 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb
classiccms-0.6.1 vendor/bundle/gems/thor-0.14.6/spec/shell/color_spec.rb