I can understand in RSpec, we fake an @output@ object to let it pass, but I don’t understand in the real code:
When @Game@ is initialized, how does it know where is the @output@ come from?
Yes, we made an instance of @Output@ class in step_definitions, but how these two file(@game.rb@ and @codebreaker_steps.rb@) connected with each other? How real code can get the information from the test code when they both not to declare @require@ each other?
In @env.rb@, we indeed required the @codebreaker.rb@ in it, thus I can understand that cucumber should be able to get in touch with the REAL code, but this should be ONE-WAY PATH, isn’t it?
And yes!, I’ve noticed these code below
When /^I start a new game$/ do game = Codebreaker::Game.new(output) game.start end
but these code should be a part of TEST and not for the REAL, right? I’m confused :(
I’m new for this, so if I’m stupid, plz forgive, thanks for help.