Sha256: 44adce5d684d311840bf0d5eab3aefae5faf0cdacf8d2d4cad957aafea1037f1

Contents?: true

Size: 820 Bytes

Versions: 4

Compression:

Stored size: 820 Bytes

Contents

require 'spec_helper'

describe Virtus::AttributesAccessor, '#define_reader_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_reader_method_spec.rb
virtus-0.5.0 spec/unit/virtus/attributes_accessor/define_reader_method_spec.rb
virtus-0.4.2 spec/unit/virtus/attributes_accessor/define_reader_method_spec.rb
virtus-0.4.1 spec/unit/virtus/attributes_accessor/define_reader_method_spec.rb