1
vote
1answer
122 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) ...
1
vote
1answer
91 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 ...
3
votes
2answers
92 views

Can I improve the way this model RSpec is written?

I'm new to RSpec and testing in general. I've come up with a spec for testing my Content model and I need some feedback 'cause I think there are many improvements that can be done. I don't know if the ...
3
votes
2answers
1k 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 ...
1
vote
1answer
38 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
137 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 ...
2
votes
1answer
673 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 ...