Sha256: 0f7706a033326293e66df586daeaa4d7486587abe7c1f85a9f18e78007fe3552

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

require "test_helper"

class TestInstallCommand < Test::Unit::TestCase
  def setup
    @io = StringIO.new
    @command = Juicer::Command::Install.new(Logger.new(@io))
    FileUtils.rm_rf(path(".juicer/lib")) if File.exists?(path(".juicer/lib"))
  end

  context "checking version" do
    should "bring up latest from installer" do
      assert_equal "1.0", @command.version(Juicer::Install::JSLintInstaller.new)
    end

    should "use explicit version" do
      @command.instance_eval { @version = "1.0.1" }
      assert_equal "1.0.1", @command.version(Juicer::Install::JSLintInstaller.new)
    end
  end

  context "executing command" do
    should "require atleast one argument" do
      assert_raise ArgumentError do
        @command.execute
      end
    end

    should "install single library" do
      installer = Juicer::Install::JSLintInstaller.new(path(".juicer"))
      assert !installer.installed?

      @command.instance_eval { @path = path(".juicer") }
      @command.execute("jslint")

      assert installer.installed?
    end

    should "not install already installed library" do
      installer = Juicer::Install::JSLintInstaller.new(path(".juicer"))
      installer.install
      assert installer.installed?

      @command.execute("jslint")
      assert_match(/is already installed in/, @io.string)
    end

    should "install specific version" do
      installer = Juicer::Install::JSLintInstaller.new(path(".juicer"))
      assert !installer.installed?("0.9")

      @command.instance_eval { @path = path(".juicer") }
      @command.instance_eval { @version = "0.9" }
      @command.execute("jslint")

      assert installer.installed?("0.9")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
juicer-1.0.16 test/unit/juicer/command/install_test.rb
juicer-1.0.15 test/unit/juicer/command/install_test.rb
juicer-1.0.14 test/unit/juicer/command/install_test.rb