Sha256: d5dba51359363d08b6a866540595722d6f64589fef07c20e7fd609db394bfec6

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')

describe Attributor::Regexp do

  subject(:type) { Attributor::Regexp }

  its(:native_type) { should be(::Regexp) }
  its(:example) { should be_a(::String) }
  its(:family) { should == 'string' }

  context '.load' do
    let(:value) { nil }

    it 'returns nil for nil' do
      type.load(nil).should be(nil)
    end

    context 'for incoming String values' do

      { 'foo' => /foo/, '^pattern$' => /^pattern$/ }.each do |value, expected|
        it "loads '#{value}' as #{expected.inspect}" do
          type.load(value).should eq(expected)
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attributor-5.0.1 spec/types/regexp_spec.rb
attributor-5.0 spec/types/regexp_spec.rb
attributor-4.2.0 spec/types/regexp_spec.rb
attributor-4.1.0 spec/types/regexp_spec.rb
attributor-4.0.1 spec/types/regexp_spec.rb