Commit 1e833ba

mo <mo.khan@gmail.com>
2018-02-15 19:28:34
fix broken specs.
1 parent fa9cfb3
Changed files (2)
lib
spec
lib/saml/kit/assertion.rb
@@ -40,7 +40,6 @@ module Saml
 
       def active?(now = occurred_at)
         drifted_started_at = started_at - configuration.clock_drift.to_i.seconds
-        puts [now.iso8601, drifted_started_at.iso8601, expired?(now)].inspect
         now > drifted_started_at && !expired?(now)
       end
 
spec/saml/assertion_spec.rb
@@ -12,6 +12,7 @@ RSpec.describe Saml::Kit::Assertion do
       travel_to now
       not_on_or_after = configuration.session_timeout.since(now).iso8601
       xml = <<-XML
+<Response>
 <Assertion xmlns="#{Saml::Kit::Namespaces::ASSERTION}" ID="#{Xml::Kit::Id.generate}" IssueInstant="#{now.iso8601}" Version="2.0">
  <Issuer>#{FFaker::Internet.uri("https")}</Issuer>
  <Subject>
@@ -31,6 +32,7 @@ RSpec.describe Saml::Kit::Assertion do
    </AuthnContext>
  </AuthnStatement>
 </Assertion>
+</Response>
 XML
       subject = described_class.new(Nokogiri::XML(xml), configuration: configuration)
       travel_to (configuration.clock_drift - 1.second).before(now)
@@ -45,6 +47,7 @@ XML
       not_before = now.utc.iso8601
       not_after = configuration.session_timeout.since(now).iso8601
       xml = <<-XML
+<Response>
 <Assertion xmlns="#{Saml::Kit::Namespaces::ASSERTION}" ID="#{Xml::Kit::Id.generate}" IssueInstant="#{now.iso8601}" Version="2.0">
  <Issuer>#{FFaker::Internet.uri("https")}</Issuer>
  <Subject>
@@ -64,6 +67,7 @@ XML
    </AuthnContext>
  </AuthnStatement>
 </Assertion>
+</Response>
 XML
       subject = described_class.new(Nokogiri::XML(xml), configuration: configuration)
       expect(subject).to be_active
@@ -81,6 +85,7 @@ XML
       not_before = Time.now.utc.iso8601
       not_after = 10.minutes.from_now.iso8601
       xml = <<-XML
+<Response>
 <Assertion xmlns="#{Saml::Kit::Namespaces::ASSERTION}" ID="#{Xml::Kit::Id.generate}" IssueInstant="#{Time.now.iso8601}" Version="2.0">
  <Issuer>#{FFaker::Internet.uri("https")}</Issuer>
  <Subject>
@@ -100,6 +105,7 @@ XML
    </AuthnContext>
  </AuthnStatement>
 </Assertion>
+</Response>
 XML
       subject = described_class.new(Nokogiri::XML(xml))
       expect(subject).to be_present