test/direction_test.rb in direction-0.0.1 vs test/direction_test.rb in direction-0.0.2
- old
+ new
@@ -1,17 +1,21 @@
require 'test_helper'
class Person
extend Direction
- command :make_me_a_sandwich => :@friend
+ command [:make_me_a_sandwich, :cook] => :@friend
attr_accessor :friend
end
class Friend
def make_me_a_sandwich
Menu.record "I made a sandwich!"
end
+
+ def cook(what)
+ Menu.record what
+ end
end
module Menu
def self.record(text)
list << text
@@ -39,7 +43,13 @@
assert_includes Menu.list, "I made a sandwich!"
end
it 'returns the original receiver' do
assert_equal person, person.make_me_a_sandwich
+ end
+
+ it 'forwards additional arguments' do
+ assert_equal [], Menu.list
+ person.cook('yum')
+ assert_includes Menu.list, "yum"
end
end
\ No newline at end of file