Sha256: 734b683a49449c6fa56bc21ed829f4b537eb09b7879cc143b226ff7b854efa1c

Contents?: true

Size: 1.22 KB

Versions: 44

Compression:

Stored size: 1.22 KB

Contents

require "helper"

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

  describe "#initialize" do
    it "sets shell value" do
      base = MyCounter.new [1, 2], {}, :shell => shell
      expect(base.shell).to eq(shell)
    end

    it "sets the base value on the shell if an accessor is available" do
      base = MyCounter.new [1, 2], {}, :shell => shell
      expect(shell.base).to eq(base)
    end
  end

  describe "#shell" do
    it "returns the shell in use" do
      expect(MyCounter.new([1, 2]).shell).to be_kind_of(Thor::Base.shell)
    end

    it "uses $THOR_SHELL" do
      class Thor::Shell::TestShell < Thor::Shell::Basic; end

      expect(Thor::Base.shell).to eq(shell.class)
      ENV["THOR_SHELL"] = "TestShell"
      Thor::Base.shell = nil
      expect(Thor::Base.shell).to eq(Thor::Shell::TestShell)
      ENV["THOR_SHELL"] = ""
      Thor::Base.shell = shell.class
      expect(Thor::Base.shell).to eq(shell.class)
    end
  end

  describe "with_padding" do
    it "uses padding for inside block outputs" do
      base = MyCounter.new([1, 2])
      base.with_padding do
        expect(capture(:stdout) { base.say_status :padding, "cool" }.strip).to eq("padding    cool")
      end
    end
  end

end

Version data entries

44 entries across 41 versions & 19 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/thor-0.19.1/spec/shell_spec.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/spec/shell_spec.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.8 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
tdiary-5.0.2 vendor/bundle/gems/thor-0.19.1/spec/shell_spec.rb
tdiary-5.0.1 vendor/bundle/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.7 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.6 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.5 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.4 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.3 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.2 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.1 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
cvss-suite-1.0.0 vendor/cache/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/thor-0.19.1/spec/shell_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/thor-0.19.1/spec/shell_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/thor-0.19.1/spec/shell_spec.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/thor-0.19.1/spec/shell_spec.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/thor-0.19.1/spec/shell_spec.rb