Sha256: 6084019edafa1bb1b7f1f3cd77b1add9b45c103ad37db2ac2d17b2e618e6480a

Contents?: true

Size: 924 Bytes

Versions: 1

Compression:

Stored size: 924 Bytes

Contents

require 'test/unit'
require 'rubygems'
require 'mocha'

require 'rubygems/commands/open_command'
require 'rubygems/exceptions'

class Test_SomethingToTest < Test::Unit::TestCase
  def setup
  end

  def test_opening_path
    gem_name = 'neat_gem'
    gem_path = 'some/path'
    command = Gem::Commands::OpenCommand.new
    
    command.expects(:get_path).with(gem_name).returns(gem_path)
    command.expects(:open_gem).with(gem_path)
    
    command.invoke(gem_name)
  end
  
  def test_opening_nonexistent_path
    gem_name = 'neat_gem'
    gem_path = nil
    command = Gem::Commands::OpenCommand.new
    
    command.expects(:get_path).with(gem_name).returns(gem_path)
    command.expects(:open_gem).never
    
    command.invoke(gem_name)
  end
  
  def test_opening_with_no_gem_name
    command = Gem::Commands::OpenCommand.new
    
    assert_raises Gem::CommandLineError do
      command.invoke()
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adamsanderson-open_gem-1.1.0 test/open_command_test.rb