Sha256: 2ea803e1ae03a37792350d430de352e8771009fa922e6715b09d6a4cc092505c

Contents?: true

Size: 956 Bytes

Versions: 8

Compression:

Stored size: 956 Bytes

Contents

require 'spec_helper'

module SSLCheck
  describe 'IssueDateValidatorSpec' do
    before do
      @cert = Certificate.new(VALID_CERT)
      @ca_bundle = [Certificate.new(CA_PARENT), Certificate.new(CA_GRAND_PARENT)]
    end
    context "when the issue date is in the past" do
      it 'should return nothing' do
        sut = Validators::IssueDate.new("npboards.com", @cert, @ca_bundle)
        result = sut.validate(FutureClock.new)
        expect(result).to_not be
      end
    end
    context "when the issue date is in the future" do
      it 'should return errors' do
        sut = Validators::IssueDate.new("npboards.com", @cert, @ca_bundle)
        result = sut.validate(PastClock.new)
        expect(result).to be_a SSLCheck::Errors::Validation::NotYetIssued
      end
    end
  end
end

class FutureClock
  def now
    DateTime.parse("3000-01-01 00:00:00")
  end
end

class PastClock
  def now
    DateTime.parse("1000-01-01 00:00:00")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sslcheck-0.9.6 spec/issue_date_validator_spec.rb
sslcheck-0.9.5 spec/issue_date_validator_spec.rb
sslcheck-0.9.4.1 spec/issue_date_validator_spec.rb
sslcheck-0.9.4 spec/issue_date_validator_spec.rb
sslcheck-0.9.3 spec/issue_date_validator_spec.rb
sslcheck-0.9.2 spec/issue_date_validator_spec.rb
sslcheck-0.9.1 spec/issue_date_validator_spec.rb
sslcheck-0.9.0 spec/issue_date_validator_spec.rb