2
votes
1answer
44 views

Unit-testing account transaction code

I'm playing with unit-testing in Ruby. There is a situation that I don't know if is good enough or if I am doing the wrong abstraction. I have two classes: ...
2
votes
2answers
392 views

Bubble sort implementation with tests

For practice I tried implementing a bubble sort algorithm in Ruby. I'm especially interested in creating clean DRY and KISS code and keeping things readable, but efficient. Any hints to improve things ...
16
votes
4answers
8k views

How to effectively unit test a controller in Ruby on Rails?

I intend this to be a general question on writing an effective set of test cases for a controller action. I include the following ingredients: Ruby on Rails RSpec: A testing framework. I considered ...
3
votes
1answer
128 views

Can this custom Test:Unit assert be replaced/refactored? Am I missing test cases?

I have a unit test that needs to compare two arrays but it shouldn't care about the order of the arrays. I didn't see anything in the Test:Unit docs that provided this so I wrote my own. I really ...
2
votes
3answers
2k views

Ruby code style / Regular Expression to remove blank lines / test case

Forgive me to put 3 seemingly irrelevant words in the subject line. But they are the purposes of this post. This is basically my first Ruby class, which is to remove all empty lines and blank times ...