Skip to content

Commit

Permalink
Merge pull request vinibaggio#8 from brain-geek/master
Browse files Browse the repository at this point in the history
Fix for annoying error if host is not accessible by ping
  • Loading branch information
vinibaggio committed Dec 18, 2011
2 parents a69e004 + f20750a commit 4d5140d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/outpost/expectations/response_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.extended(base)
# Method that will be used as an expectation to evaluate response time
def evaluate_response_time(scout, rules)
rules.all? do |rule, comparison|
comparison && scout.response_time.send(RESPONSE_TIME_MAPPING[rule], comparison)
scout.response_time.nil? ? false : scout.response_time.send(RESPONSE_TIME_MAPPING[rule], comparison)
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion test/outpost/expectations/response_time_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def expect(expectation, evaluation_method)

describe ".evaluation_response_time with nil" do
it "should fail gracefully" do
refute SubjectTime.evaluate_response_time(scout_stub, :less_than => nil)
#this is common, as host can be not accessible for ping
refute SubjectTime.evaluate_response_time(build_stub(:response_time => nil), :less_than => 400)
end
end

Expand Down

0 comments on commit 4d5140d

Please sign in to comment.