Sha256: c0f0ce5afff3b11c3dcdd3420d0b03251ac3a3f4e10b33312ff9f5fd6f6b86e1

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 Bytes

Contents

require 'spec_helper'

describe ValidatesTimeliness, 'HelperMethods' do
  let(:record) { Person.new }
  
  it 'should define class validation methods' do
    expect(Person).to respond_to(:validates_date)
    expect(Person).to respond_to(:validates_time)
    expect(Person).to respond_to(:validates_datetime)
  end

  it 'should define instance validation methods' do
    expect(record).to respond_to(:validates_date)
    expect(record).to respond_to(:validates_time)
    expect(record).to respond_to(:validates_datetime)
  end

  it 'should validate instance using class validation defined' do
    Person.validates_date :birth_date
    record.valid?

    expect(record.errors[:birth_date]).not_to be_empty
  end

  it 'should validate instance using instance valiation method' do
    record.validates_date :birth_date

    expect(record.errors[:birth_date]).not_to be_empty
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
validates_timeliness-4.0.0 spec/validates_timeliness/helper_methods_spec.rb
sp-validates_timeliness-3.1.3 spec/validates_timeliness/helper_methods_spec.rb
sp-validates_timeliness-3.1.2 spec/validates_timeliness/helper_methods_spec.rb
jc-validates_timeliness-3.1.1 spec/validates_timeliness/helper_methods_spec.rb
jc-validates_timeliness-3.1.0 spec/validates_timeliness/helper_methods_spec.rb