Sha256: 931f7e1fa6f762ec8b8ff2f638caf4f6ef87aa8018070866f6cb809e4f4bed56
Contents?: true
Size: 945 Bytes
Versions: 3
Compression:
Stored size: 945 Bytes
Contents
require 'mixers/advisable' require 'test/unit' class TestAdvice < Test::Unit::TestCase class X include Advisable attr_reader :out def initialize @out = [] end before :x do @out << "BEFORE X#x" end after :x do @out << "AFTER X#x" end def x @out << "X#x" "x" end end class Y < X before :x do @out << "BEFORE Y#x" end after :x do @out << "AFTER Y#x" end around :x do |target| "{" + target.call + "}" end def x @out << "Y#x" super end end # tests def setup @x = X.new @y = Y.new end def test_x r = @x.x o = @x.out assert_equal("x", r) assert_equal(["BEFORE X#x", "X#x", "AFTER X#x"], o) end def test_y r = @y.x o = @y.out assert_equal("{x}", r) assert_equal(["BEFORE Y#x", "BEFORE X#x", "Y#x", "X#x", "AFTER X#x", "AFTER Y#x"], o) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mixers-1.2.0 | test/test_advisable.rb |
mixers-1.1.0 | test/test_advisable.rb |
mixers-1.0.0 | test/test_advisable.rb |