Sha256: ac5ef2e48428108447ed83677f4095cbbc01aeba5ae1a8d4d65a82bc58af088a

Contents?: true

Size: 487 Bytes

Versions: 4

Compression:

Stored size: 487 Bytes

Contents

require 'spec_helper'

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

  let(:object) { described_class.new }
  let(:value)  { Object.new      }

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

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

    it { should be(coerced) }
  end

  context 'when the value does not respond to #to_str' 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_string_spec.rb
coercible-0.1.0 spec/unit/coercible/coercer/object/to_string_spec.rb
coercible-0.0.2 spec/unit/coercible/coercer/object/to_string_spec.rb
coercible-0.0.1 spec/unit/coercible/coercer/object/to_string_spec.rb