Posts Tagged ‘testing

01
Oct
09

to RSpec or not to RSpec

I took another look at RSpec today. I tried to re-write the script using a test driven development method but am finding it harder to use than expected. I think I just have to shift my brain into programming TDD style. I really didn’t come up with any good code, I must have started over at least 10 times. I started with things like it “should accept a parameter –operation that takes either ‘add’ or ‘sub’ as it’s value” Then I would read RSpec docs and try to test tha…needless to say it’s a good way to learn about RSpec albeit rather slow. Hopefully I can move my brain to this new style of thinking. It seemed so easy at first but once you try it, it’s actually kind of difficult to do.

Here is the list of requirements I’m going to be working off of.

  • it “should accept two parameters, an operation that is either add or sub and a time value formatted at least with one digit. It should also accept two arguments, an in_file and na out_file”
  • it “should add or subtract time based on the set operation”
  • it “should modify the time by the amount passed in as a parameter of –time”
  • it “should read times and all other lines from the first file”
  • it “should write modified times and unmodified other lines to the second file”

IF you can get these tests to pass, then you’ve got yourself a working program and RSpec test to go with it as well as some documentation!

Until next time…




Challenges

How often I post

July 2017
M T W T F S S
« Dec    
 12
3456789
10111213141516
17181920212223
24252627282930
31  

This is everything