Sha256: 4ce537a483bc0ba1136f53f620bb4e26dc01230d3830388225a023bfcd315775

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Attribute::Numeric#valid_value?' do
  subject { object.valid_value?(value) }

  let(:klass)  { Attribute::Numeric                  }
  let(:object) { klass.new(:numeric, :size => 1..50) }

  context 'with a numeric value' do
    context 'that is within the allowed size range' do
      let(:value) { 1 }

      it { should be(true) }
    end

    context 'that is greater than the allowed size range' do
      let(:value) { 51 }

      it { should be(false) }
    end

    context 'that is less than the allowed size range' do
      let(:value) { 0 }

      it { should be(false) }
    end
  end

  context 'with a value that is not a numeric' do
    let(:value) { 'a' }

    it { should be(false) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/attribute/numeric/valid_value_spec.rb