Sha256: ee41181caec9fc2faa5ad624d3e6a05a597099b83435457d1777492a5ee0c736

Contents?: true

Size: 1 KB

Versions: 13

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe Virtus::Attribute, '#define_writer_method' do
  subject { object.define_writer_method(mod) }

  let(:object)            { described_class.new(:name, options)                              }
  let(:options)           { { :primitive => primitive, :coercion_method => coercion_method } }
  let(:primitive)         { stub('primitive')                                                }
  let(:coercion_method)   { stub('coercion_method')                                          }
  let(:writer_visibility) { stub('writer_visibility')                                        }
  let(:mod)               { mock('mod')                                                      }

  before do
    options.update(:writer => writer_visibility)
    mod.stub(:define_writer_method).with(object, :name=, writer_visibility)
  end

  it { should be(object) }

  it 'calls #define_writer_method on the module' do
    mod.should_receive(:define_writer_method).with(object, :name=, writer_visibility)
    subject
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

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