Sha256: d8af4cb7c39b1aa3beea759f38957e300608da5265ecba0fd95acd2f56c26b1e

Contents?: true

Size: 523 Bytes

Versions: 13

Compression:

Stored size: 523 Bytes

Contents

require 'spec_helper'

describe Virtus::InstanceMethods, '#to_hash' do
  subject { object.to_hash }

  class Model
    include Virtus

    attribute :name,  String
    attribute :age,   Integer
    attribute :email, String, :accessor => :private
  end

  let(:model)      { Model                           }
  let(:object)     { model.new(attributes)           }
  let(:attributes) { { :name => 'john', :age => 28 } }

  it { should be_instance_of(Hash) }

  it 'returns attributes' do
    should eql(attributes)
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

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