diff options
Diffstat (limited to 'test/rubygems/test_gem_commands_pristine_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_pristine_command.rb | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_commands_pristine_command.rb b/test/rubygems/test_gem_commands_pristine_command.rb index 78c3f85a5b..1767397d16 100644 --- a/test/rubygems/test_gem_commands_pristine_command.rb +++ b/test/rubygems/test_gem_commands_pristine_command.rb @@ -110,6 +110,41 @@ class TestGemCommandsPristineCommand < Gem::TestCase end end + def test_execute_extensions_explicit + a = quick_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end + + ext_path = File.join @tempdir, 'ext', 'a', 'extconf.rb' + write_file ext_path do |io| + io.write <<-'RUBY' + File.open "Makefile", "w" do |f| + f.puts "all:\n\techo built\n" + f.puts "install:\n\techo built\n" + end + RUBY + end + + b = quick_spec 'b' + + install_gem a + install_gem b + + @cmd.options[:extensions] = true + @cmd.options[:extensions_set] = true + @cmd.options[:args] = [] + + use_ui @ui do + @cmd.execute + end + + out = @ui.output.split "\n" + + assert_equal 'Restoring gems to pristine condition...', out.shift + assert_equal 'Building native extensions. This could take a while...', + out.shift + assert_equal "Restored #{a.full_name}", out.shift + assert_empty out, out.inspect + end + def test_execute_no_extension a = quick_spec 'a' do |s| s.extensions << 'ext/a/extconf.rb' end @@ -320,5 +355,24 @@ class TestGemCommandsPristineCommand < Gem::TestCase @ui.output.split("\n")) assert_empty(@ui.error) end + + def test_handle_options + @cmd.handle_options %w[] + + refute @cmd.options[:all] + + assert @cmd.options[:extensions] + refute @cmd.options[:extensions_set] + + assert_equal Gem::Requirement.default, @cmd.options[:version] + end + + def test_handle_options_extensions + @cmd.handle_options %w[--extensions] + + assert @cmd.options[:extensions] + assert @cmd.options[:extensions_set] + end + end |