Fix coding standards in specs
This commit is contained in:
parent
e6f6475705
commit
2acf0371b5
@ -9,8 +9,8 @@ describe API::PlaylistsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
playlist_1 = FactoryGirl.create(:playlist, name: 'Playlist 1')
|
||||
playlist_2 = FactoryGirl.create(:playlist, name: 'Playlist 2')
|
||||
FactoryGirl.create(:playlist, name: 'Playlist 1')
|
||||
FactoryGirl.create(:playlist, name: 'Playlist 2')
|
||||
end
|
||||
|
||||
def do_get
|
||||
|
@ -13,8 +13,8 @@ describe HomeController do
|
||||
end
|
||||
|
||||
it 'assigns latest tracks as @tracks' do
|
||||
track1 = FactoryGirl.create(:track, created_at: '2011-07-27 19:13:42')
|
||||
track2 = FactoryGirl.create(:track, created_at: '2011-07-27 19:58:57')
|
||||
FactoryGirl.create(:track, created_at: '2011-07-27 19:13:42')
|
||||
FactoryGirl.create(:track, created_at: '2011-07-27 19:58:57')
|
||||
get :index
|
||||
expect(assigns[:tracks]).to eq Track.latest
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ describe PlaylistsController do
|
||||
end
|
||||
|
||||
describe 'PUT update' do
|
||||
let (:playlist) { FactoryGirl.create(:playlist) }
|
||||
let(:playlist) { FactoryGirl.create(:playlist) }
|
||||
|
||||
def do_update
|
||||
put :update, id: playlist.id.to_s, playlist: { name: 'Rock' }
|
||||
@ -71,7 +71,7 @@ describe PlaylistsController do
|
||||
context 'whith valid params' do
|
||||
it 'updates the playlist' do
|
||||
expect_any_instance_of(Playlist)
|
||||
.to receive(:update_attributes).with({'name' => 'Rock'})
|
||||
.to receive(:update_attributes).with('name' => 'Rock')
|
||||
do_update
|
||||
end
|
||||
|
||||
|
@ -22,12 +22,12 @@ describe TracksController do
|
||||
|
||||
describe 'POST create new' do
|
||||
def do_create
|
||||
post :create, track: FactoryGirl.attributes_for(:track).merge({
|
||||
post :create, track: FactoryGirl.attributes_for(:track).merge(
|
||||
file: fixture_file_upload(
|
||||
"#{Rails.root}/spec/fixtures/test.mp3",
|
||||
'audio/mpeg'
|
||||
)
|
||||
})
|
||||
)
|
||||
end
|
||||
|
||||
context 'whith valid params' do
|
||||
|
@ -6,7 +6,7 @@ feature 'Home page' do
|
||||
background { sign_in }
|
||||
|
||||
scenario 'displays playlists' do
|
||||
playlist = FactoryGirl.create(:playlist, name: 'Electro')
|
||||
FactoryGirl.create(:playlist, name: 'Electro')
|
||||
|
||||
visit root_path
|
||||
|
||||
|
@ -19,7 +19,7 @@ feature 'API cross origin request' do
|
||||
:options,
|
||||
api_playlists_path(format: :json),
|
||||
nil,
|
||||
{ 'Origin' => origin }
|
||||
'Origin' => origin
|
||||
)
|
||||
|
||||
expect(response.headers['Access-Control-Allow-Origin']).to eq origin
|
||||
@ -32,9 +32,7 @@ feature 'API cross origin request' do
|
||||
|
||||
scenario 'basic request' do
|
||||
# FIXME: replace with a more stable/generic action
|
||||
get api_playlists_path(format: :json), nil, {
|
||||
'Origin' => origin
|
||||
}
|
||||
get api_playlists_path(format: :json), nil, 'Origin' => origin
|
||||
|
||||
expect(response.headers['Access-Control-Allow-Origin']).to eq origin
|
||||
expect(response.headers['Access-Control-Allow-Credentials']).to eq 'true'
|
||||
|
@ -21,7 +21,7 @@ describe Sound do
|
||||
end
|
||||
|
||||
describe '#file=' do
|
||||
let (:file) { FactoryGirl.attributes_for(:sound)[:file] }
|
||||
let(:file) { FactoryGirl.attributes_for(:sound)[:file] }
|
||||
|
||||
it 'saves the file SHA256 digest' do
|
||||
expect(sound.sha256).to eq Digest::SHA256.file(file.path).hexdigest
|
||||
|
@ -26,7 +26,7 @@ describe Track do
|
||||
it 'builds a new related sound with the file' do
|
||||
sounds = double 'sounds association proxy'
|
||||
allow(track).to receive(:sounds) { sounds }
|
||||
expect(sounds).to receive(:build).with({file: file})
|
||||
expect(sounds).to receive(:build).with(file: file)
|
||||
track.file = file
|
||||
end
|
||||
end
|
||||
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe '/api OPTIONS requests routing' do
|
||||
it 'routes to API::ApplicationController#cor_preflight' do
|
||||
expect({ options: '/api/some_route' })
|
||||
expect(options: '/api/some_route')
|
||||
.to route_to(
|
||||
controller: 'api/application',
|
||||
action: 'cor_preflight',
|
||||
|
@ -7,7 +7,8 @@ describe 'playlists/edit' do
|
||||
|
||||
it 'renders a form to edit a playlist' do
|
||||
render
|
||||
expect(rendered).to have_selector("form[method=post][action='#{playlists_path}']")
|
||||
expect(rendered)
|
||||
.to have_selector("form[method=post][action='#{playlists_path}']")
|
||||
expect(rendered).to have_selector('input[type=submit]')
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user