ruby - Test Driven Development with RSpec -


I'm new to testing and I need to add code in the code file so that the test specification file passes

I wrote a comment in the code file, where I think the test should be written, but how do I write them, so that they pass?

My spec code looks like this:

  "wad_TIM_00_gen" module is required ImpossibleMachine # Input and Output Constants Processed by Sub-Processes DOWN_ARROW = 1 UP_ARROW = 2 RIGHT_ARROW = 3 REPEAT_ARROW = 4 END_PROCESS = 5 START_CURRENT = 6 # Describe the description of the RSPEC test, before the # "start up impossible machine game" (: each) do @process = [] @output = double ('Output'). As_null_object @game = Game.new (@output) End it "Send Welcome Message" to @ @ @ output.should_receive (puts) .with ('Welcome to Impossible Machine!') @ Game It starts with the "initial message" do @ output.should_receive (puts) .with ('the game is starting ...') @ game.start and end << / >>  < P>  and my code file looks like this:   
  # main class module module contains the input and output constants processed by ImpossibleMachine # SubPublishing Do not change DOWN_ARROW = 1 UP_ARROW = 2 RIGHT_ARROW = 3 REPEAT_ARROW = 4 END_PROCESS = 5 START_CURRENT = 6 class game attr_reader: process, output attr_writer: process, output def start (output) @out put = output "[# {@ output} 'Ends' End # I think the tests should be written here at the end of the end.    

in TDD , the first test for the code you write As I have seen, you have already written the exam, now you have to write the actual implementation of the place where you have commented. You need to implement the start function so that your tests are passed.

You can read about TDD , and with about TDD RSPC .

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -