Sha256: f93bb40ed1a3eaf55e358ea789c64fbed005b3f3c64bdfcf9e2dc591682fe526

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

[ :size, :range ].each do |method|
  describe Attribute::Numeric, "##{method}" do
    subject { object.send(method) }

    context 'without :size option passed to constructor' do
      let(:object) { described_class.new(:id) }

      it_should_behave_like 'an idempotent method'

      it { should eql(-Float::INFINITY..Float::INFINITY) }
    end

    context 'with a :size option passed to constructor that is inclusive' do
      let(:object) { described_class.new(:id, :size => 1..100) }

      it_should_behave_like 'an idempotent method'

      it { should eql(1..100) }
    end

    context 'with a :size option passed to constructor that is exclusive' do
      let(:object) { described_class.new(:id, :size => 1...101) }

      it_should_behave_like 'an idempotent method'

      it { should eql(1..100) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/attribute/numeric/size_spec.rb