Sha256: 61773dcd0b0a716ffe7bab873b22d275f6c21f4f7892fb8a1b6154cb70ae2367

Contents?: true

Size: 822 Bytes

Versions: 13

Compression:

Stored size: 822 Bytes

Contents

require 'spec_helper'

describe Virtus::Attribute, '#public_reader?' do
  subject { object.public_reader? }

  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')                                          }

  context 'when :reader is not not specified' do
    it { should be(true) }
  end

  { :public => true, :protected => false, :private => false }.each do |value, expected|
    context "when :reader is #{value.inspect}" do
      before do
        options.update(:reader => value)
      end

      it { should be(expected) }
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

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