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
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_private_reader.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/lgrgic_palindrome_detector-0.1.0/vendor/cache/gems/rake-10.5.0/test/test_private_reader.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/rake-10.5.0/test/test_private_reader.rb
lgrgic_palindrome_detector-0.1.0 vendor/cache/gems/rake-10.5.0/test/test_private_reader.rb
xaiml-0.1.1 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_private_reader.rb
xaiml-0.1.0 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_private_reader.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_private_reader.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_private_reader.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_private_reader.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_private_reader.rb
wfrey_palindrome-0.1.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_private_reader.rb
wfrey_palindrome-0.1.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_private_reader.rb
bsielski_control_flow-1.0.0 vendor/bundle/ruby/2.5.0/gems/rake-10.5.0/test/test_private_reader.rb
daslabs-0.12.0 vendor/cache/ruby/2.5.0/gems/rake-10.5.0/test/test_private_reader.rb
daslabs-0.11.0 vendor/cache/ruby/2.5.0/gems/rake-10.5.0/test/test_private_reader.rb
sprokovuln-0.2.0 vendor/ruby/gems/rake-10.5.0/test/test_private_reader.rb
mercadopago-custom-checkout-0.1.2 .gs/gems/rake-10.5.0/test/test_private_reader.rb
monero_wallet_gen-0.1.0 vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/test/test_private_reader.rb
sb_prime_table-0.1.1 vendor/bundle/ruby/2.4.0/gems/rake-10.5.0/test/test_private_reader.rb
sb_prime_table-0.1.0 vendor/bundle/ruby/2.4.0/gems/rake-10.5.0/test/test_private_reader.rb