Skip to content

Commit b79859f

Browse files
committed
Fix java specs
1 parent a35e8bc commit b79859f

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

lib/onelogin/ruby-saml/slo_logoutrequest.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,15 @@ def validate_version
186186
true
187187
end
188188

189-
# Validates the time. (If the logout request was initialized with the :allowed_clock_drift option, the timing validations are relaxed by the allowed_clock_drift value)
189+
# Validates the time. (If the logout request was initialized with the :allowed_clock_drift
190+
# option, the timing validations are relaxed by the allowed_clock_drift value)
190191
# If fails, the error is added to the errors array
191192
# @return [Boolean] True if satisfies the conditions, otherwise False if soft=True
192193
# @raise [ValidationError] if soft == false and validation fails
193194
#
194195
def validate_not_on_or_after
195196
now = Time.now.utc
197+
196198
if not_on_or_after && now >= (not_on_or_after + allowed_clock_drift)
197199
return append_error("Current time is on or after NotOnOrAfter (#{now} >= #{not_on_or_after}#{" + #{allowed_clock_drift.ceil}s" if allowed_clock_drift > 0})")
198200
end

test/response_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ def generate_audience_error(expected, actual)
11421142

11431143
it "optionally allows for clock drift on NotOnOrAfter" do
11441144
# Java Floats behave differently than MRI
1145-
java = %w[jruby truffleruby].include?(ENV['RUBY_ENGINE'])
1145+
java = defined?(RUBY_ENGINE) && %w[jruby truffleruby].include?(RUBY_ENGINE)
11461146

11471147
settings.soft = true
11481148

test/slo_logoutrequest_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class RubySamlTest < Minitest::Test
186186

187187
it "optionally allows for clock drift" do
188188
# Java Floats behave differently than MRI
189-
java = %w[jruby truffleruby].include?(ENV['RUBY_ENGINE'])
189+
java = defined?(RUBY_ENGINE) && %w[jruby truffleruby].include?(RUBY_ENGINE)
190190

191191
logout_request.soft = true
192192
logout_request.document.root.attributes['NotOnOrAfter'] = '2011-06-14T18:31:01.516Z'

0 commit comments

Comments
 (0)