Permalink
Browse files

Add test for suggest with dashes and underscores

  • Loading branch information...
1 parent f6b91ce commit 14656a4d3bb8737b7f15621e78a2b527bcdb58dd Justin Collins committed Mar 13, 2012
Showing with 24 additions and 0 deletions.
  1. +24 −0 test/rubygems/test_gem_commands_install_command.rb
@@ -205,6 +205,30 @@ def test_execute_nonexistent_with_hint
assert_equal expected, @ui.error
end
+ def test_execute_nonexistent_with_dashes
+ misspelled = "non-existent_with-hint"
+ correctly_spelled = "nonexistent-with_hint"
+
+ util_setup_fake_fetcher
+ util_setup_spec_fetcher quick_spec(correctly_spelled, '2')
+
+ @cmd.options[:args] = [misspelled]
+
+ use_ui @ui do
+ e = assert_raises Gem::SystemExitException do
+ @cmd.execute
+ end
+
+ assert_equal 2, e.exit_code
+ end
+
+ expected = "ERROR: Could not find a valid gem 'non-existent_with-hint' (>= 0) in any repository
@luislavena

luislavena Jun 20, 2012

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.

+ERROR: Possible alternatives: nonexistent-with_hint
+"
+
+ assert_equal expected, @ui.error
+ end
+
def test_execute_conflicting_install_options
@cmd.options[:user_install] = true
@cmd.options[:install_dir] = "whatever"

0 comments on commit 14656a4

Please sign in to comment.