Permalink
Browse files

Unordered hashes are a bane (and only fail on travis), take 2

  • Loading branch information...
1 parent afa1c64 commit 851af3c9dc97f956627b3b6bdd8a8b5523495e83 @arsduo committed Apr 1, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 spec/cases/http_service_spec.rb
View
11 spec/cases/http_service_spec.rb
@@ -280,8 +280,15 @@
it "logs verb, url and params to debug" do
args = {"a" => :b, "c" => 3}
- log_message = "POST: anything params: #{args.inspect}"
- Koala::Utils.logger.should_receive(:debug).with(log_message)
+ log_message_stem = "POST: anything params: "
+ Koala::Utils.logger.should_receive(:debug) do |log_message|
+ # unordered hashes are a bane
+ # Ruby in 1.8 modes tends to return different hash orderings,
+ # which makes checking the content of the stringified hash hard
+ # it's enough just to ensure that there's hash content in the string, I think
+ log_message.should include(log_message_stem)
+ log_message.match(/\{.*\}/).should_not be_nil
+ end
Koala::HTTPService.make_request("anything", args, "post")
end
end

0 comments on commit 851af3c

Please sign in to comment.