Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add test for suggest with dashes and underscores

  • Loading branch information...
commit 14656a4d3bb8737b7f15621e78a2b527bcdb58dd 1 parent f6b91ce
Justin authored

Showing 1 changed file with 24 additions and 0 deletions. Show diff stats Hide diff stats

  1. +24 0 test/rubygems/test_gem_commands_install_command.rb
24 test/rubygems/test_gem_commands_install_command.rb
@@ -205,6 +205,30 @@ def test_execute_nonexistent_with_hint
205 205 assert_equal expected, @ui.error
206 206 end
207 207
  208 + def test_execute_nonexistent_with_dashes
  209 + misspelled = "non-existent_with-hint"
  210 + correctly_spelled = "nonexistent-with_hint"
  211 +
  212 + util_setup_fake_fetcher
  213 + util_setup_spec_fetcher quick_spec(correctly_spelled, '2')
  214 +
  215 + @cmd.options[:args] = [misspelled]
  216 +
  217 + use_ui @ui do
  218 + e = assert_raises Gem::SystemExitException do
  219 + @cmd.execute
  220 + end
  221 +
  222 + assert_equal 2, e.exit_code
  223 + end
  224 +
  225 + expected = "ERROR: Could not find a valid gem 'non-existent_with-hint' (>= 0) in any repository
  226 +ERROR: Possible alternatives: nonexistent-with_hint
  227 +"
  228 +
  229 + assert_equal expected, @ui.error
  230 + end
  231 +
208 232 def test_execute_conflicting_install_options
209 233 @cmd.options[:user_install] = true
210 234 @cmd.options[:install_dir] = "whatever"

0 comments on commit 14656a4

Luis Lavena

Can you split @ui.error and check individual lines?

Asking because on Windows line endings are \r\n while POSIX is just \n, since you're comparing the exact output on this it might fail.

Please sign in to comment.
Something went wrong with that request. Please try again.