Sha256: 3c7a1c9236f8cac0a3c380ff2b3832aa9d5bf3768d94df99a6f1c1dc11d53b47

Contents?: true

Size: 967 Bytes

Versions: 13

Compression:

Stored size: 967 Bytes

Contents

require 'spec_helper'

describe Virtus::Attribute, '#inspect' do
  subject { object.inspect }

  let(:object)          { described_class.new(:name, options)                              }
  let(:options)         { { :primitive => primitive, :coercion_method => coercion_method } }
  let(:primitive)       { stub('primitive')                                                }
  let(:coercion_method) { stub('coercion_method')                                          }

  context 'with a named attribute class' do
    let(:described_class) { NamedAttribute = Class.new(Virtus::Attribute) }

    after do
      klass = Object.class_eval { remove_const(:NamedAttribute) }
      Virtus::Attribute.descendants.delete(klass)
    end

    it { should eql("#<NamedAttribute @name=:name>") }
  end

  context 'with an anonymous attribute class' do
    let(:described_class) { Class.new(Virtus::Attribute) }

    it { should eql("#<#{described_class} @name=:name>") }
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
virtus-0.5.5 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.5.4 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.5.3 spec/unit/virtus/attribute/inspect_spec.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/virtus-0.5.2/spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.5.2 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.5.1 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.5.0 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.4.2 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.4.1 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.4.0 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.3.0 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.2.0 spec/unit/virtus/attribute/inspect_spec.rb
virtus-0.1.0 spec/unit/virtus/attribute/inspect_spec.rb