Sha256: 682f717f1bb45b2b0bbc817d697e262d1c3a69d76e2daefb44f6d793dc8c3ad3

Contents?: true

Size: 673 Bytes

Versions: 68

Compression:

Stored size: 673 Bytes

Contents

require 'spec_helper'

describe Hydra::FutureDateValidator do
  let(:future_date) { Date.today + 2 }
  let(:past_date) { Date.today - 2 }
  let(:validator) { Hydra::FutureDateValidator.new(attributes: [:embargo_release_date, :lease_expiration_date]) }
  before do
    validator.validate(subject)
  end
 
  context "when date is valid" do
    subject { ModsAsset.new(embargo_release_date: future_date) }
    its(:errors) { should be_empty }
  end

  context "when date is invalid" do
    subject { ModsAsset.new(lease_expiration_date: past_date) }
    it "has errors" do
      expect(subject.errors[:lease_expiration_date]).to eq ['Must be a future date']
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
hydra-access-controls-9.6.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.5.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.4.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.4.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.3.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.2.2 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.2.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.2.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.2.0.rc1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.1.4 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.1.3 spec/validators/future_date_validator_spec.rb
hydra-access-controls-8.1.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.1.2 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.1.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.1.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-8.0.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.0.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.0.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.0.0.rc3 spec/validators/future_date_validator_spec.rb
hydra-access-controls-9.0.0.rc2 spec/validators/future_date_validator_spec.rb