2
votes
1answer
39 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: ...
6
votes
1answer
106 views

Binary converter and sufficient tests

I just finished writing a basic binary conversion class in Ruby. I'm curious to see if anyone has suggestions for improvements. In particular, I'm looking for the cleanest, shortest, most succinct ...
3
votes
1answer
240 views

My first controller rspec test

I'm just started learning TDD with Rails and RSpec. This is my first test for controller. Just plain RESTful UserController that responds with JSON, so it has no new and edit methods. Please review it ...
5
votes
1answer
80 views

BinarySearch Kata in Ruby

I've just completed this binary search kata - which has some weird requirements - and I spent a little while "cleaning" up my code and making it more compact. I would appreciate some feedback on the ...
9
votes
2answers
165 views

Cash Register Kata

The Setup This kata is a spin on the old backpack problem. Please give feedback on both the kata itself as well as my solution. I'm not sure if the kata needs to lead the student more or if this is a ...
3
votes
1answer
102 views

Pig Latin Translator in Ruby and Rspec

PigLatin Kata ...
2
votes
3answers
203 views

Pig Latin Code Kata

I've just complete a Pig Latin translator as a code kata and I was hoping someone would review it for me. Here is the kata: ...
2
votes
1answer
167 views

How can this rails controller test be cleaner refactored?

I tend to write quite explicit tests for my rails controllers exposing APIs with two seperate concerns: meeting the defined API-Response with headers headers and the response itself ensuring the ...
0
votes
1answer
77 views

Ruby Kata Gem: WordWrap

I've just completed the WordWrap Kata in the Ruby Kata gem and I'd love some feedback. Thanks! Here's the Kata: ...
2
votes
1answer
117 views

Advanced Calculator Kata

This is the CalculatorAdvanced Kata from the Kata gem. I've just finished it and would love some feedback on my solution. ...
3
votes
1answer
130 views

Weekly flex calculator

This is one of the first RSpec tests I've written, and I'm not really sure what the best practices are etc. My question basically is: what would you do differently? What is good? What is bad? The ...
2
votes
1answer
59 views

Using RSpec subject to setup a test

I find myself using subject blocks in my tests to setup example because it is succinct. However is this considered bad form and can it have undesired consequences? ...
2
votes
1answer
64 views

How to separate 2 tangled methods?

I have this (working) code: ...
1
vote
1answer
61 views

Refactor specs for service class methods

Service Class ...
1
vote
1answer
62 views

Converting tests to specs

I use RSpec but in a way I would use any xUnit framework. Can this snippet be refactored to look more BDD like (using subject and stuff)? ...
3
votes
1answer
145 views

How might I make this code more DRY?

I have the following Ruby code in an RSpec file: ...
5
votes
2answers
375 views

Spoj's 1st problem in tdd using Ruby

I am pretty new to TDD and is following problems on spoj.pl for practice. I need help with following code; it was my first attempt. Problem: Your program is to use the brute-force approach in order ...
2
votes
3answers
183 views

First BDD/RSpec tests, would like some review regarding idioms, conventions and style

This is my first attempt at BDD and RSpec. I'm more of a C# xUnit kind of guy. I wrote this class while developing a 2D random tile map generator (just for fun). The project is still ongoing. I ...
2
votes
1answer
261 views

What can I do to improve my first RSpec test

I'm relatively familiar with Ruby, but I'm brand new to testing my code. I decided to use RSpec because as it seems like a popular option and wrote a basic Rock Paper Scissors game to be tested. The ...