Sha256: 644ab1722bc20be3b83481c5ff47fb73cd16202c339610bdb06b3754c39a1b20
Contents?: true
Size: 445 Bytes
Versions: 6
Compression:
Stored size: 445 Bytes
Contents
require "spec_helper" describe Object, ".attr_private" do let(:klass) do Class.new do attr_private :foo, :bar end end it "creates private readers" do example = klass.new example.instance_variable_set("@foo", "Foo") example.instance_variable_set("@bar", "Bar") _(example.send(:foo)).must_equal "Foo" _(example.send(:bar)).must_equal "Bar" _(lambda { example.foo }).must_raise NoMethodError end end
Version data entries
6 entries across 6 versions & 1 rubygems