Sha256: c08200ccfcbbf721cfb45ac465bee02523cc6e50cd7d8fa872f228b8436203d0

Contents?: true

Size: 749 Bytes

Versions: 5

Compression:

Stored size: 749 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:object) { described_class.new(:string, :min_length => 1, :max_length => 50) }

  context 'with a string value' do
    context 'that is within the allowed length range' do
      let(:value) { 'a' }

      it { should be(true) }
    end

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

      it { should be(false) }
    end

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

      it { should be(false) }
    end
  end

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

    it { should be(false) }
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/attribute/string/valid_value_predicate_spec.rb
veritas-0.0.7 spec/unit/veritas/attribute/string/valid_value_spec.rb
veritas-0.0.6 spec/unit/veritas/attribute/string/valid_value_spec.rb
veritas-0.0.5 spec/unit/veritas/attribute/string/valid_value_spec.rb
veritas-0.0.4 spec/unit/veritas/attribute/string/valid_value_spec.rb