Permalink
Browse files

Force alphabetical order on tests to make specs pass on both 1.8 and …

…1.9.
  • Loading branch information...
1 parent 34ba174 commit 611d00f432a08ed9ff1c3a3dc2c4ecc9b2d4ba08 @BanzaiMan BanzaiMan committed Jan 21, 2013
Showing with 9 additions and 4 deletions.
  1. +7 −2 lib/rhc/wizard.rb
  2. +2 −2 spec/wizard_spec_helper.rb
View
9 lib/rhc/wizard.rb
@@ -367,12 +367,17 @@ def show_app_info_stage
# Perform basic tests to ensure that setup is sane
# search for private methods starting with "test_" and execute them
- # do not assume test execution order
+ # in alphabetical order
+ # NOTE: The order itself is not important--the tests should be independent.
+ # However, the hash order is unpredictable in Ruby 1.8, and is preserved in
+ # 1.9. There are two similar tests that can fail under the same conditions,
+ # and this makes the spec results inconsistent between 1.8 and 1.9.
+ # Thus, we force an order with #sort to ensure spec passage on both.
def setup_test_stage
tests_passed = false
info "Analyzing system (one dot for each test)"
tests = private_methods.select {|m| m.to_s.start_with? 'test_'}
- tests_passed = tests.all? do |test|
+ tests_passed = tests.sort.all? do |test|
send(test)
end
end
View
4 spec/wizard_spec_helper.rb
@@ -114,15 +114,15 @@ def should_find_ssh_keys
next_stage.should_not be_nil
last_output do |s|
- s.should_not match(/No SSH key is uploaded to the server/)
+ s.should_not match(/Remote server does not have the corresponding SSH key/)
end
end
def should_not_find_ssh_keys
next_stage.should_not be_nil
last_output do |s|
- s.should match(/No SSH key is uploaded to the server/)
+ s.should match(/Remote server does not have the corresponding SSH key/)
end
end

0 comments on commit 611d00f

Please sign in to comment.