Sha256: 195c866784407cfc784eb4c7234b59e63c67b39e64fa67869f63877fed33925c

Contents?: true

Size: 921 Bytes

Versions: 12

Compression:

Stored size: 921 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

12 entries across 12 versions & 3 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/open_gem-1.4.2/test/open_command_test.rb
adamsanderson-open_gem-1.2.0 test/open_command_test.rb
adamsanderson-open_gem-1.3.0 test/open_command_test.rb
adamsanderson-open_gem-1.3.1 test/open_command_test.rb
adamsanderson-open_gem-1.3.2 test/open_command_test.rb
adamsanderson-open_gem-1.4.0 test/open_command_test.rb
open_gem-1.5.0 test/open_command_test.rb
open_gem-1.4.2 test/open_command_test.rb
open_gem-1.4.0 test/open_command_test.rb
open_gem-1.3.1 test/open_command_test.rb
open_gem-1.3.0 test/open_command_test.rb
open_gem-1.2.0 test/open_command_test.rb