Sha256: b11dae4744c9d94dc7723c59fa88664f328a8daba53a6d91ba192cdde178119c

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

require File.expand_path('../../fixtures/classes', __FILE__)

describe "DelegateClass.private_instance_methods" do
  before :all do
    @methods = DelegateSpecs::DelegateClass.private_instance_methods
  end

  ruby_version_is ""..."1.9" do
    it "does not include any instance methods of the delegated class" do
      @methods.should_not include "pub"
      @methods.should_not include "prot"
      @methods.should_not include "priv" # since these are not forwarded...
    end

    it "includes private instance methods of the DelegateClass class" do
      @methods.should include "extra_private"
    end

    it "does not include public or protected instance methods of the DelegateClass class" do
      @methods.should_not include "extra"
      @methods.should_not include "extra_protected"
    end
  end

  ruby_version_is "1.9" do
    it "does not include any instance methods of the delegated class" do
      @methods.should_not include :pub
      @methods.should_not include :prot
      @methods.should_not include :priv # since these are not forwarded...
    end

    it "includes private instance methods of the DelegateClass class" do
      @methods.should include :extra_private
    end

    it "does not include public or protected instance methods of the DelegateClass class" do
      @methods.should_not include :extra
      @methods.should_not include :extra_protected
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubysl-delegate-2.0.1 spec/delegate_class/private_instance_methods_spec.rb
rubysl-delegate-1.0.0 spec/delegate_class/private_instance_methods_spec.rb
rubysl-delegate-2.0.0 spec/delegate_class/private_instance_methods_spec.rb