test/direction_test.rb in direction-0.0.4 vs test/direction_test.rb in direction-0.0.5
- old
+ new
@@ -7,15 +7,15 @@
attr_accessor :friend
end
class Friend
def make_me_a_sandwich
- Menu.record "I made a sandwich!"
+ Table.place "a sandwich!"
end
def cook(what)
- Menu.record what
+ Table.place what
end
def activities
'running, biking, hiking'
end
@@ -31,19 +31,19 @@
def say_what(text)
[yield(self).to_s,text].join(' ')
end
end
-module Menu
- def self.record(text)
- list << text
+module Table
+ def self.place(text)
+ contents << text
end
- def self.list
- @list ||= []
+ def self.contents
+ @contents ||= []
end
def self.clear
- @list = []
+ @contents = []
end
end
module Activities
def self.record(text)
@@ -62,26 +62,26 @@
let(:person){ person = Person.new
person.friend = friend
person
}
before do
- Menu.clear
+ Table.clear
Activities.clear
end
it 'forwards a message to another object' do
- assert_equal [], Menu.list
+ assert_equal [], Table.contents
person.make_me_a_sandwich
- assert_includes Menu.list, "I made a sandwich!"
+ assert_includes Table.contents, "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
+ assert_equal [], Table.contents
person.cook('yum')
- assert_includes Menu.list, "yum"
+ assert_includes Table.contents, "yum"
end
it 'forwards block arguments' do
assert_equal [], Activities.list
person.blocky('yay!') do |friend|
\ No newline at end of file