summaryrefslogtreecommitdiff
path: root/spec/ruby/core/method/protected_spec.rb
blob: 6ee85f77387931f1262badd43fa121680d8a0022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require_relative '../../spec_helper'
require_relative 'fixtures/classes'

ruby_version_is "3.1"..."3.2" do
  describe "Method#protected?" do
    it "returns false when the method is public" do
      obj = MethodSpecs::Methods.new
      obj.method(:my_public_method).protected?.should == false
    end

    it "returns true when the method is protected" do
      obj = MethodSpecs::Methods.new
      obj.method(:my_protected_method).protected?.should == true
    end

    it "returns false when the method is private" do
      obj = MethodSpecs::Methods.new
      obj.method(:my_private_method).protected?.should == false
    end
  end
end