Sha256: 1f6e95036aa12b4006bf67a110a14a94da20fb7f6a5bb03190beca658f2cc2f3

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

require_relative '../../../spec_helper'
require_relative '../../shared/macros/integration_spec'
require 'aequitas'

Aequitas::Macros::IntegrationSpec.describe Aequitas::Macros, '#validates_value_of' do
  require 'date'

  describe 'with a lambda that returns lower and upper bounds' do
    before do
      class_under_test.validates_value_of attribute_name, :in => bound
    end

    let(:bound) { lambda { (Date.today - 5)..Date.today } }

    describe 'when validated attribute value is within the range' do
      let(:attribute_value) { bound.call.begin + 1 }

      it_should_be_a_valid_instance
    end

    describe 'when validated attribute value is not within the range' do
      let(:attribute_value) { bound.call.end + 1 }

      it_should_be_an_invalid_instance
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aequitas-0.0.2 spec/integration/aequitas/macros/validates_value_of_spec.rb