Tagged Questions
1
vote
1answer
39 views
Refactor specs for service class methods
Service Class
# services/search.rb
class Search
include Rails.application.routes.url_helpers
include ActionView::Helpers::TagHelper
def initialize(term, app_ids)
@term = term
@app_ids ...
1
vote
1answer
61 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)?
describe Time do
describe ".from_sql" do
it "parses ...
2
votes
0answers
110 views
How might I make this code more DRY?
I have the following Ruby code in an RSpec file:
describe "order" do
before do
LIST_LENGTH ||= 10
@skills = FactoryGirl.create_list(:skill, LIST_LENGTH)
@developer = ...
5
votes
2answers
183 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 ...
0
votes
0answers
79 views
Rspec code for height map generator
Here is my rspec file for a height map generator. The code and the tests works, but I would like some review on my rpsec code.
require './height_map'
require './gaussian_filter'
require ...
2
votes
3answers
140 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
211 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 ...