Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

43 lines (30 sloc) 0.7 kb
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
Jump to Line
Something went wrong with that request. Please try again.