Sha256: 084b74a60796862c1f7eb1f62de88d3bb31431f50c82f8ae977409971495bf8d
Contents?: true
Size: 997 Bytes
Versions: 19
Compression:
Stored size: 997 Bytes
Contents
require 'spec_helper' class Validatable include ActiveModel::Validations attr_accessor :embargo_release_date validates :embargo_release_date, future_date: true end describe FutureDateValidator do subject { Validatable.new } before { subject.embargo_release_date = embargo_release_date } context 'with today as embargo release date' do let(:embargo_release_date) { Date.today.to_s } it { should have(1).error_on(:embargo_release_date) } end context 'with past date as embargo release date' do let(:embargo_release_date) { (Date.today - 2).to_s } it { should have(1).error_on(:embargo_release_date) } end context 'invalid date as embargo release date' do let(:embargo_release_date) { "invalid_ date" } it { should have(1).error_on(:embargo_release_date) } end context 'future date as embargo release date' do let(:embargo_release_date) { (Date.today + 2).to_s } it { should have(:no).error_on(:embargo_release_date) } end end
Version data entries
19 entries across 19 versions & 1 rubygems