Sha256: 8f0c84135d831c9181fc6489d4d2787a6648c9597686c0521e943980ccbe158e

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 Bytes

Contents

require 'spec_helper'

describe Virtus, '.determine_type' do
  Virtus::Attribute.descendants.each do |attribute_class|

    context "with class #{attribute_class.inspect}" do
      subject { described_class.determine_type(attribute_class) }

      it 'returns the corresponding attribute class' do
        should be(attribute_class)
      end
    end

    primitive = attribute_class.primitive
    context "with primitive #{primitive.inspect}" do
      subject { described_class.determine_type(primitive) }

      it 'returns the corresponding attribute class' do
        should be(attribute_class)
      end
    end

    suffix = attribute_class.name['Virtus::Attribute::'.length..-1]
    context "with string #{suffix.inspect}" do
      subject { described_class.determine_type(suffix) }

      it 'returns the corresponding attribute class' do
        should be(attribute_class)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
virtus-0.0.4 spec/unit/virtus/determine_type_spec.rb