Sha256: 9e5b7bc27c1465af2e3af298c03e6d9784dc52ea6144a72451ebc50431e9c689

Contents?: true

Size: 935 Bytes

Versions: 1

Compression:

Stored size: 935 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "singleton_method_added" do
  it "should work if target method is defined after singleton_method_added and singleton_method_added calls super" do
    class AdvicesOnClassMethod1
      include Aspect4r
        
      def self.singleton_method_added(method)
        super
      end
      
      class << self
        
        def value
          @value ||= []
        end
  
        around :test do |proxy|
          value << "around1"
          a4r_invoke proxy
          value << "around2"
        end   
      
        before :test do
          value << "before"
        end
  
        after :test do |result|
          value << "after"
        end
      
        def test
          value << "test"
        end
      end
    end
    
    AdvicesOnClassMethod1.test
    AdvicesOnClassMethod1.value.should == %w(before around1 test around2 after)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aspect4r-0.9.0 spec/aspect4r/singleton_method_added_spec.rb