Sha256: 9792fbb15d8bf3d2ed82ab16ed4c97c352eb58f3e1d601220dd2cb467ae59f03

Contents?: true

Size: 700 Bytes

Versions: 337

Compression:

Stored size: 700 Bytes

Contents

require File.expand_path('../helper', __FILE__)
require 'rake/private_reader'

class TestPrivateAttrs < Rake::TestCase

  class Sample
    include Rake::PrivateReader

    private_reader :reader, :a

    def initialize
      @reader = :RVALUE
    end

    def get_reader
      reader
    end

  end

  def setup
    super
    @sample = Sample.new
  end

  def test_private_reader_is_private
    assert_private do @sample.reader end
    assert_private do @sample.a end
  end

  def test_private_reader_returns_data
    assert_equal :RVALUE, @sample.get_reader
  end

  private

  def assert_private
    ex = assert_raises(NoMethodError) do yield end
    assert_match(/private/, ex.message)
  end

end

Version data entries

337 entries across 296 versions & 96 rubygems

Version Path
rake-10.1.0.beta.2 test/test_private_reader.rb
rake-10.1.0.beta.1 test/test_private_reader.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/rake-10.0.3/test/test_private_reader.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/test/test_private_reader.rb
challah-1.0.0.beta2 vendor/bundle/gems/rake-10.0.4/test/test_private_reader.rb
challah-1.0.0.beta vendor/bundle/gems/rake-10.0.4/test/test_private_reader.rb
challah-1.0.0.beta vendor/bundle/gems/rake-10.0.3/test/test_private_reader.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/test/test_private_reader.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/test/test_private_reader.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/test/test_private_reader.rb
torquebox-console-0.2.5 vendor/bundle/ruby/1.8/gems/rake-10.0.3/test/test_private_reader.rb
torquebox-console-0.2.5 vendor/bundle/jruby/1.9/gems/rake-10.0.3/test/test_private_reader.rb
rake-10.0.4 test/test_private_reader.rb
vagrant-actionio-0.0.9 vendor/bundle/gems/rake-10.0.3/test/test_private_reader.rb
torquebox-console-0.2.4 vendor/bundle/ruby/1.8/gems/rake-10.0.3/test/test_private_reader.rb
torquebox-console-0.2.4 vendor/bundle/jruby/1.9/gems/rake-10.0.3/test/test_private_reader.rb
torquebox-console-0.2.3 vendor/bundle/jruby/1.9/gems/rake-10.0.3/test/test_private_reader.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_private_reader.rb
active_mailer-0.0.4 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_private_reader.rb
active_mailer-0.0.3 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/test/test_private_reader.rb