Sha256: 4de41dd38dc9e80e5921a44f311f8d1cf81dfe8586c3206cf657c8e533701e99

Contents?: true

Size: 867 Bytes

Versions: 23

Compression:

Stored size: 867 Bytes

Contents

RSpec.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

23 entries across 23 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/validates_timeliness-4.0.2/spec/validates_timeliness/helper_methods_spec.rb
validates_timeliness-4.0.2 spec/validates_timeliness/helper_methods_spec.rb
validates_timeliness-4.0.1 spec/validates_timeliness/helper_methods_spec.rb