1require 'rubygems/test_case'
2require 'rubygems/commands/outdated_command'
3
4class TestGemCommandsOutdatedCommand < Gem::TestCase
5
6  def setup
7    super
8
9    @cmd = Gem::Commands::OutdatedCommand.new
10  end
11
12  def test_initialize
13    assert @cmd.handles?(%W[--platform #{Gem::Platform.local}])
14  end
15
16  def test_execute
17    remote_10 = quick_spec 'foo', '1.0'
18    remote_20 = quick_spec 'foo', '2.0'
19
20    Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
21
22    util_clear_gems
23    util_setup_spec_fetcher remote_10, remote_20
24
25    quick_gem 'foo', '0.1'
26    quick_gem 'foo', '0.2'
27
28    Gem::Specification.reset
29
30    use_ui @ui do
31      @cmd.execute
32    end
33
34    assert_equal "foo (0.2 < 2.0)\n", @ui.output
35    assert_equal "", @ui.error
36  end
37end
38
39