Sha256: d3e09f650400f20f3f40fbc0f417133bb246263dd24be750b2d579dc8486ab0a

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

require 'helper'

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

  describe "#say" do
    it "sets the color if specified" do
      out = capture(:stdout) { shell.say "Wow! Now we have colors!", :green }
      expect(out.chomp).to eq('<span style="color: green;">Wow! Now we have colors!</span>')
    end

    it "sets bold if specified" do
      out = capture(:stdout) { shell.say "Wow! Now we have colors *and* bold!", [:green, :bold] }
      expect(out.chomp).to eq('<span style="color: green; font-weight: bold;">Wow! Now we have colors *and* bold!</span>')
    end

    it "does not use a new line even with colors" do
      out = capture(:stdout) { shell.say "Wow! Now we have colors! ", :green }
      expect(out.chomp).to eq('<span style="color: green;">Wow! Now we have colors! </span>')
    end
  end

  describe "#say_status" do
    it "uses color to say status" do
      expect($stdout).to receive(:print).with("<span style=\"color: red; font-weight: bold;\">    conflict</span>  README\n")
      shell.say_status :conflict, "README", :red
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
acquia_toolbelt-2.4.1 lib/vendor/thor/spec/shell/html_spec.rb
acquia_toolbelt-2.4.0 lib/vendor/thor/spec/shell/html_spec.rb
acquia_toolbelt-2.3.2 lib/vendor/thor/spec/shell/html_spec.rb
acquia_toolbelt-2.3.1 lib/vendor/thor/spec/shell/html_spec.rb
acquia_toolbelt-2.0.1 lib/vendor/thor/spec/shell/html_spec.rb
acquia_toolbelt-2.0.0 lib/vendor/thor/spec/shell/html_spec.rb
thor_dleavitt-0.18.1 spec/shell/html_spec.rb
thor-dleavitt-0.18.1 spec/shell/html_spec.rb