Sha256: e2c3d532e81f4f2001cac82adef96e46ada30370e8dc71d49acbe88b1cbf4980

Contents?: true

Size: 586 Bytes

Versions: 13

Compression:

Stored size: 586 Bytes

Contents

require 'spec_helper'

describe Virtus::AttributeSet, '#[]' do
  subject { object[name] }

  let(:name)       { :name                                   }
  let(:attribute)  { mock('Attribute', :name => name)        }
  let(:attributes) { [ attribute ]                           }
  let(:parent)     { described_class.new                     }
  let(:object)     { described_class.new(parent, attributes) }

  it { should equal(attribute) }

  it 'allows indexed access to attributes by the string representation of their name' do
    object[name.to_s].should equal(attribute)
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

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