Sha256: 84dbf3f68d3855a1504c1b04a1185e2b9ce93aee45d41419b9b1a07c8984a2b4

Contents?: true

Size: 924 Bytes

Versions: 3

Compression:

Stored size: 924 Bytes

Contents

require 'spec_helper'

describe Virtus::Attribute::EmbeddedValue, '.build' do
  subject { described_class.build(type) }

  context 'when type is a virtus model' do
    let(:type) { Class.new { include Virtus } }

    it { should be_frozen }

    it { should be_instance_of(Virtus::Attribute::EmbeddedValue::FromOpenStruct) }
  end

  context 'when type is an OpenStruct subclass' do
    let(:type) { Class.new(OpenStruct) }

    it { should be_frozen }

    it { should be_instance_of(Virtus::Attribute::EmbeddedValue::FromOpenStruct) }
  end

  context 'when type is OpenStruct' do
    let(:type) { OpenStruct }

    it { should be_frozen }

    it { should be_instance_of(Virtus::Attribute::EmbeddedValue::FromOpenStruct) }
  end

  context 'when type is Struct' do
    let(:type) { Struct.new(:test) }

    it { should be_frozen }

    it { should be_instance_of(Virtus::Attribute::EmbeddedValue::FromStruct) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
virtus-1.0.0.beta5 spec/unit/virtus/attribute/embedded_value/class_methods/build_spec.rb
virtus-1.0.0.beta4 spec/unit/virtus/attribute/embedded_value/class_methods/build_spec.rb
virtus-1.0.0.beta3 spec/unit/virtus/attribute/embedded_value/class_methods/build_spec.rb