Sha256: f56ac49dc670e0323f333e52094a335d43f00e969cb3a8bff68bee84e2cd2079

Contents?: true

Size: 494 Bytes

Versions: 11

Compression:

Stored size: 494 Bytes

Contents

require 'spec_helper'

describe Virtus::Coercion::Object, '.to_integer' do
  subject { object.to_integer(value) }

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

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

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

    it { should be(coerced) }
  end

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

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
virtus-0.5.5 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.5.4 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.5.3 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/virtus-0.5.2/spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.5.2 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.5.1 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.5.0 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.4.2 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.4.1 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.4.0 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb
virtus-0.3.0 spec/unit/virtus/coercion/object/class_methods/to_integer_spec.rb