Sha256: d2432a350745bc29e8c6c5c67f558482c51c2d62cc159a206e4d4f1580f8f127

Contents?: true

Size: 486 Bytes

Versions: 4

Compression:

Stored size: 486 Bytes

Contents

require 'spec_helper'

describe Coercer::Object, '.to_hash' do
  subject { object.to_hash(value) }

  let(:object) { described_class.new }
  let(:value)  { stub('value')   }

  context 'when the value responds to #to_hash' do
    let(:coerced) { stub('coerced') }

    before do
      value.should_receive(:to_hash).with().and_return(coerced)
    end

    it { should be(coerced) }
  end

  context 'when the value does not respond to #to_hash' do
    it { should be(value) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coercible-0.2.0 spec/unit/coercible/coercer/object/to_hash_spec.rb
coercible-0.1.0 spec/unit/coercible/coercer/object/to_hash_spec.rb
coercible-0.0.2 spec/unit/coercible/coercer/object/to_hash_spec.rb
coercible-0.0.1 spec/unit/coercible/coercer/object/to_hash_spec.rb