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