Tagged Questions

RSpec is a Behaviour-Driven Development tool for Ruby programmers.

learn more… | top users | synonyms

1
vote
0answers
13 views

RSpec integration tests for a simple Rails API

The Model is simple. A Player class with three attributes: first_name, last_name, and team_id. I'm just trying to get a handle on TDD for what will expand into a much more robust API. Below is my ...
2
votes
0answers
46 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 = ...
4
votes
2answers
72 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 ...
1
vote
1answer
55 views

Is the comparing active record result with array of object in rspec test flexible?

Is the test flexible? describe "self.sort" do before(:each) do @tee = FactoryGirl.create :author, nickname: "tee jia hen", user: FactoryGirl.create(:user) @jon = FactoryGirl.create ...
1
vote
0answers
55 views

How to refactor my controller specs?

In my project (https://github.com/GCorbel/comment-my-projects) I have this kind of code to test my controllers. #encoding=utf-8 require 'spec_helper' describe ProjectsController do let!(:project) ...
0
votes
0answers
59 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
106 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 ...
1
vote
1answer
67 views

Rspec Request always break when teammate push some changes, how to improve?

This is my rspec integration test for user , it always break when my teammate change something , how do i improve this? describe "Users" do before(:each) do populate_role end describe ...
1
vote
1answer
332 views

Tidying scaffolded Rails controller spec with subject/let

I was just looking at a standard scaffolded Rails controller spec, and tried to get it to use subject or let blocks, and failed miserably ... can subject or let tidy controller specs the same as it ...
2
votes
1answer
169 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 ...