Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Force alphabetical order on tests to make specs pass on both 1.8 and …
Browse files Browse the repository at this point in the history
…1.9.
  • Loading branch information
BanzaiMan committed Jan 21, 2013
1 parent 34ba174 commit 611d00f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions lib/rhc/wizard.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/wizard_spec_helper.rb
Expand Up @@ -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

Expand Down

0 comments on commit 611d00f

Please sign in to comment.