Skip to content

Commit 62fd461

Browse files
committed
Update test for Ruby 2.2.0
1 parent d136471 commit 62fd461

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

test/response_test.rb

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,23 @@ class RubySamlTest < Minitest::Test
195195
assert response.send(:validate_conditions, true)
196196
end
197197

198-
it "optionally allow for clock drift" do
198+
it "optionally allows for clock drift" do
199199
# The NotBefore condition in the document is 2011-06-14T18:21:01.516Z
200-
Time.stubs(:now).returns(Time.parse("2011-06-14T18:21:01Z"))
201-
response = OneLogin::RubySaml::Response.new(response_document_5, :allowed_clock_drift => 0.515)
202-
assert !response.send(:validate_conditions, true)
200+
Timecop.freeze(Time.parse("2011-06-14T18:21:01Z")) do
201+
response = OneLogin::RubySaml::Response.new(
202+
response_document_5,
203+
:allowed_clock_drift => 0.515
204+
)
205+
assert !response.send(:validate_conditions, true)
206+
end
203207

204-
Time.stubs(:now).returns(Time.parse("2011-06-14T18:21:01Z"))
205-
response = OneLogin::RubySaml::Response.new(response_document_5, :allowed_clock_drift => 0.516)
206-
assert response.send(:validate_conditions, true)
208+
Timecop.freeze(Time.parse("2011-06-14T18:21:01Z")) do
209+
response = OneLogin::RubySaml::Response.new(
210+
response_document_5,
211+
:allowed_clock_drift => 0.516
212+
)
213+
assert response.send(:validate_conditions, true)
214+
end
207215
end
208216
end
209217

0 commit comments

Comments
 (0)