Sha256: 13a936f7e6f8b97576e1d62172d82daa32cdbae8f966f0a9651ed2391ad460a9

Contents?: true

Size: 822 Bytes

Versions: 4

Compression:

Stored size: 822 Bytes

Contents

require 'spec_helper'

describe Virtus::AttributesAccessor, '#define_writer_method' do
  subject { described_class.new('Test') }

  let(:attribute) { mock('attribute') }

  if RUBY_VERSION < '1.9'
    let(:method_name) { 'foo_bar=' }
  else
    let(:method_name) { :foo_bar= }
  end

  before do
    subject.define_reader_method(attribute, method_name, visibility)
  end

  context "with public visibility" do
    let(:visibility) { :public }

    its(:public_instance_methods) { should include(method_name) }
  end

  context "with private visibility" do
    let(:visibility) { :private }

    its(:private_instance_methods) { should include(method_name) }
  end

  context "with protected visibility" do
    let(:visibility) { :protected }

    its(:protected_instance_methods) { should include(method_name) }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
virtus-0.5.1 spec/unit/virtus/attributes_accessor/define_writer_method_spec.rb
virtus-0.5.0 spec/unit/virtus/attributes_accessor/define_writer_method_spec.rb
virtus-0.4.2 spec/unit/virtus/attributes_accessor/define_writer_method_spec.rb
virtus-0.4.1 spec/unit/virtus/attributes_accessor/define_writer_method_spec.rb