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-13.0.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-12.1.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-12.0.2 spec/validators/future_date_validator_spec.rb
hydra-access-controls-11.0.7 spec/validators/future_date_validator_spec.rb
hydra-access-controls-12.0.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-11.0.6 spec/validators/future_date_validator_spec.rb
hydra-access-controls-12.0.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-11.0.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-11.0.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-11.0.0.rc2 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.7.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.6.2 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.6.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.6.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.5.1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-11.0.0.rc1 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.5.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-8.2.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.4.0 spec/validators/future_date_validator_spec.rb
hydra-access-controls-10.4.0.rc2 spec/validators/future_date_validator_spec.rb