Sha256: 1e85104f6f75d1a883df9d7e0b0bd48229b85bf8987b519fc6a155069471aac1

Contents?: true

Size: 1.23 KB

Versions: 192

Compression:

Stored size: 1.23 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_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
      base.shell.should == shell
    end

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

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

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

      Thor::Base.shell.should == shell.class
      ENV['THOR_SHELL'] = 'TestShell'
      Thor::Base.shell = nil
      Thor::Base.shell.should == Thor::Shell::TestShell
      ENV['THOR_SHELL'] = ''
      Thor::Base.shell = shell.class
      Thor::Base.shell.should == 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
        capture(:stdout){ base.say_status :padding, "cool" }.strip.should == "padding    cool"
      end
    end
  end

end

Version data entries

192 entries across 123 versions & 20 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/thor-0.14.6/spec/shell_spec.rb
classiccms-0.7.5 vendor/bundle/gems/thor-0.15.2/spec/shell_spec.rb
classiccms-0.7.5 vendor/bundle/gems/thor-0.14.6/spec/shell_spec.rb
classiccms-0.7.4 vendor/bundle/gems/thor-0.14.6/spec/shell_spec.rb
classiccms-0.7.4 vendor/bundle/gems/thor-0.15.2/spec/shell_spec.rb
classiccms-0.7.3 vendor/bundle/gems/thor-0.14.6/spec/shell_spec.rb
classiccms-0.7.3 vendor/bundle/gems/thor-0.15.2/spec/shell_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/thor-0.14.6/spec/shell_spec.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/thor-0.14.6/spec/shell_spec.rb
wijet-thor-0.14.10 spec/shell_spec.rb
classiccms-0.7.2 vendor/bundle/gems/thor-0.14.6/spec/shell_spec.rb
classiccms-0.7.2 vendor/bundle/gems/thor-0.15.2/spec/shell_spec.rb
classiccms-0.7.1 vendor/bundle/gems/thor-0.15.2/spec/shell_spec.rb
classiccms-0.7.1 vendor/bundle/gems/thor-0.14.6/spec/shell_spec.rb
classiccms-0.7.0 vendor/bundle/gems/thor-0.15.2/spec/shell_spec.rb
classiccms-0.7.0 vendor/bundle/gems/thor-0.14.6/spec/shell_spec.rb
challah-1.0.0.beta vendor/bundle/gems/thor-0.16.0/spec/shell_spec.rb
wijet-thor-0.14.9 spec/shell_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/thor-0.16.0/spec/shell_spec.rb
backbone-queryparams-rails-0.0.1 vendor/bundle/gems/thor-0.16.0/spec/shell_spec.rb