Sha256: 3a4a3ea6e8375d6d7e92a528e8d0acda339c41657a5f805be3028270d3ef9bdf

Contents?: true

Size: 762 Bytes

Versions: 17

Compression:

Stored size: 762 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
    expect(type.new.is_a?(Attributor::Dumpable)).not_to be(true)
  end

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

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

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

    context 'for incoming String values' do
      { 'foo' => /foo/, '^pattern$' => /^pattern$/ }.each do |value, expected|
        it "loads '#{value}' as #{expected.inspect}" do
          expect(type.load(value)).to eq(expected)
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
attributor-8.0 spec/types/regexp_spec.rb
attributor-7.1 spec/types/regexp_spec.rb
attributor-7.0 spec/types/regexp_spec.rb
attributor-6.5 spec/types/regexp_spec.rb
attributor-6.4 spec/types/regexp_spec.rb
attributor-6.3 spec/types/regexp_spec.rb
attributor-6.2 spec/types/regexp_spec.rb
attributor-6.1 spec/types/regexp_spec.rb
attributor-6.0 spec/types/regexp_spec.rb
attributor-5.7 spec/types/regexp_spec.rb
attributor-5.6 spec/types/regexp_spec.rb
attributor-5.5 spec/types/regexp_spec.rb
attributor-5.4 spec/types/regexp_spec.rb
attributor-5.3 spec/types/regexp_spec.rb
attributor-5.2.1 spec/types/regexp_spec.rb
attributor-5.2.0 spec/types/regexp_spec.rb
attributor-5.1.0 spec/types/regexp_spec.rb