Sha256: b296eec555cf891fb9eb93e5dea7160c31e984e4675638f12322ae091ffb2506

Contents?: true

Size: 1.07 KB

Versions: 69

Compression:

Stored size: 1.07 KB

Contents

require 'helper'

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

  describe "#say" do
    it "set 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
      $stdout.should_receive(:puts).with('<span style="color: red; font-weight: bold;">    conflict</span>  README')
      shell.say_status :conflict, "README", :red
    end
  end

end

Version data entries

69 entries across 61 versions & 12 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/thor-0.18.1/spec/shell/html_spec.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/thor-0.18.1/spec/shell/html_spec.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/thor-0.18.1/spec/shell/html_spec.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.6.0/gems/thor-0.18.1/spec/shell/html_spec.rb