Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fail gracefully if the response_time is nil

  • Loading branch information...
commit 6692b5aa7303dcdd6f81cc410d149701d8130c84 1 parent 9e5817c
@vinibaggio vinibaggio authored
View
2  lib/outpost/expectations/response_time.rb
@@ -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|
- scout.response_time.send(RESPONSE_TIME_MAPPING[rule], comparison)
+ comparison && scout.response_time.send(RESPONSE_TIME_MAPPING[rule], comparison)
end
end
end
View
6 test/outpost/expectations/response_time_test.rb
@@ -14,6 +14,12 @@ def expect(expectation, evaluation_method)
extend Outpost::Expectations::ResponseTime
end
+ describe ".evaluation_response_time with nil" do
+ it "should fail gracefully" do
+ refute SubjectTime.evaluate_response_time(scout_stub, :less_than => nil)
+ end
+ end
+
describe ".evaluate_response_time with less_than" do
it "should return true when it matches" do
assert SubjectTime.evaluate_response_time(scout_stub, :less_than => 5000)
Please sign in to comment.
Something went wrong with that request. Please try again.