Use one-liners in specs where possible

This commit is contained in:
Thibault Jouan
2014-04-01 18:32:22 +00:00
parent 4cef7aeab9
commit 0c7bf69ba2
22 changed files with 35 additions and 103 deletions

View File

@@ -3,14 +3,10 @@ require 'spec_helper'
describe API::ApplicationController do
include UserControllerHelpers
before do
sign_in
end
before { sign_in }
context 'CORS: Cross-Origin Ressource Sharing' do
before do
request.headers['Origin'] = 'http://origin.example/'
end
before { request.headers['Origin'] = 'http://origin.example/' }
context 'preflight' do
controller(API::ApplicationController) do

View File

@@ -3,9 +3,7 @@ require 'spec_helper'
describe API::PlaylistsController do
include UserControllerHelpers
before do
sign_in
end
before { sign_in }
describe 'GET index' do
render_views

View File

@@ -12,9 +12,7 @@ describe API::SessionsController do
end
context 'with valid credentials' do
before do
do_create
end
before { do_create }
it 'signs the user in' do
expect(controller.current_user).to eq user

View File

@@ -3,9 +3,7 @@ require 'spec_helper'
describe API::TracksController do
include UserControllerHelpers
before do
sign_in
end
before { sign_in }
describe 'GET index' do
render_views

View File

@@ -3,9 +3,7 @@ require 'spec_helper'
describe HomeController do
include UserControllerHelpers
before do
sign_in
end
before { sign_in }
describe 'GET index' do
it 'assigns all playlists as @playlists' do

View File

@@ -3,9 +3,7 @@ require 'spec_helper'
describe PlaylistsController do
include UserControllerHelpers
before do
sign_in
end
before { sign_in }
describe 'GET index' do
it 'assigns all playlists as @playlists' do

View File

@@ -3,9 +3,7 @@ require 'spec_helper'
describe SoundsController do
include UserControllerHelpers
before do
sign_in
end
before { sign_in }
describe 'GET show' do
let(:sound) { FactoryGirl.create(:sound) }

View File

@@ -3,9 +3,7 @@ require 'spec_helper'
describe TracksController do
include UserControllerHelpers
before do
sign_in
end
before { sign_in }
describe 'GET show' do
it 'assigns the requested track as @track' do
@@ -46,9 +44,7 @@ describe TracksController do
end
context 'whith invalid params' do
before do
allow_any_instance_of(Track).to receive(:save) { false }
end
before { allow_any_instance_of(Track).to receive(:save) { false } }
it 'assigns the track as @track' do
do_create