Sha256: 0d415d52faee3c7af138f7ba9d0ee6aaae1204480c4d1fb07e63e619f6f62eab
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe "Advices on singleton method (also known as class method)" do it "class method" do class AdvicesOnClassMethod include Aspect4r class << self def value @value ||= [] end around :test do |proxy| value << "around(before)" a4r_invoke proxy value << "around(after)" end before :test do value << "before" end after :test do value << "after" end def test value << "test" end end end AdvicesOnClassMethod.test AdvicesOnClassMethod.value.should == %w(before around(before) test around(after) after) end it "module singleton method" do module AdvicesOnModuleSingletonMethod include Aspect4r class << self def value @value ||= [] end around :test do |proxy| value << "around(before)" a4r_invoke proxy value << "around(after)" end before :test do value << "before" end after :test do value << "after" end def test value << "test" end end end AdvicesOnModuleSingletonMethod.test AdvicesOnModuleSingletonMethod.value.should == %w(before around(before) test around(after) after) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aspect4r-0.9.0 | spec/aspect4r/advice_on_class_method_spec.rb |