Sha256: 64624089de603a76de6a5b0a125cf4b7d125cbffe9eed030689a231382c4fed8

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

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

describe Attributor::Regexp do

  subject(:type) { Attributor::Regexp }

  it 'it is not Dumpable' do
    type.new.is_a?(Attributor::Dumpable).should_not be(true)
  end

  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

1 entries across 1 versions & 1 rubygems

Version Path
attributor-5.0.2 spec/types/regexp_spec.rb