Update factory girl to last version
This commit is contained in:
@@ -11,8 +11,8 @@ describe API::PlaylistsController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
playlist_1 = Factory.create(:playlist, :name => 'Playlist 1')
|
||||
playlist_2 = Factory.create(:playlist, :name => 'Playlist 2')
|
||||
playlist_1 = FactoryGirl.create(:playlist, :name => 'Playlist 1')
|
||||
playlist_2 = FactoryGirl.create(:playlist, :name => 'Playlist 2')
|
||||
end
|
||||
|
||||
def do_get
|
||||
@@ -37,7 +37,7 @@ describe API::PlaylistsController do
|
||||
def do_create
|
||||
post :create,
|
||||
:format => :json,
|
||||
:playlist => Factory.attributes_for(:playlist)
|
||||
:playlist => FactoryGirl.attributes_for(:playlist)
|
||||
end
|
||||
|
||||
it 'creates a new playlist for the current user' do
|
||||
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe API::SessionsController do
|
||||
describe 'POST create' do
|
||||
let(:user) { Factory.create(:user) }
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
def do_create
|
||||
post :create, :format => :json, :session => {
|
||||
|
@@ -11,8 +11,8 @@ describe API::TracksController do
|
||||
render_views
|
||||
|
||||
before do
|
||||
Factory.create(:track_with_sound)
|
||||
Factory.create(:track_with_sound)
|
||||
FactoryGirl.create(:track_with_sound)
|
||||
FactoryGirl.create(:track_with_sound)
|
||||
end
|
||||
|
||||
def do_get
|
||||
|
@@ -1,7 +1,7 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe ApplicationController do
|
||||
let(:user) { Factory.create(:user) }
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
describe '#current_user=' do
|
||||
it 'stores the user id in the session as :user_id' do
|
||||
|
@@ -9,14 +9,14 @@ describe HomeController do
|
||||
|
||||
describe 'GET index' do
|
||||
it 'assigns all playlists as @playlists' do
|
||||
playlist = Factory.create(:playlist)
|
||||
playlist = FactoryGirl.create(:playlist)
|
||||
get :index
|
||||
assigns[:playlists].should == [playlist]
|
||||
end
|
||||
|
||||
it 'assigns latest tracks as @tracks' do
|
||||
track1 = Factory.create(:track, :created_at => '2011-07-27 19:13:42')
|
||||
track2 = Factory.create(:track, :created_at => '2011-07-27 19:58:57')
|
||||
track1 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:13:42')
|
||||
track2 = FactoryGirl.create(:track, :created_at => '2011-07-27 19:58:57')
|
||||
get :index
|
||||
assigns[:tracks].should == Track.latest
|
||||
end
|
||||
|
@@ -9,7 +9,7 @@ describe PlaylistsController do
|
||||
|
||||
describe 'GET index' do
|
||||
it 'assigns all playlists as @playlists' do
|
||||
playlist = Factory.create(:playlist)
|
||||
playlist = FactoryGirl.create(:playlist)
|
||||
get :index
|
||||
assigns[:playlists].should == [playlist]
|
||||
end
|
||||
@@ -24,7 +24,7 @@ describe PlaylistsController do
|
||||
|
||||
describe 'GET edit' do
|
||||
it 'assigns the requested playlist as @playlist' do
|
||||
playlist = Factory.create(:playlist)
|
||||
playlist = FactoryGirl.create(:playlist)
|
||||
get :edit, :id => playlist.id.to_s
|
||||
assigns[:playlist].should == playlist
|
||||
end
|
||||
@@ -32,7 +32,7 @@ describe PlaylistsController do
|
||||
|
||||
describe 'POST create' do
|
||||
def do_create
|
||||
post :create, :playlist => Factory.attributes_for(:playlist)
|
||||
post :create, :playlist => FactoryGirl.attributes_for(:playlist)
|
||||
end
|
||||
|
||||
context 'whith valid params' do
|
||||
@@ -64,7 +64,7 @@ describe PlaylistsController do
|
||||
end
|
||||
|
||||
describe 'PUT update' do
|
||||
let (:playlist) { Factory.create(:playlist) }
|
||||
let (:playlist) { FactoryGirl.create(:playlist) }
|
||||
|
||||
def do_update
|
||||
put :update, :id => playlist.id.to_s, :playlist => { :name => 'Rock' }
|
||||
|
@@ -8,7 +8,7 @@ describe SessionsController do
|
||||
end
|
||||
|
||||
describe 'POST create' do
|
||||
let(:user) { Factory.create(:user) }
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
def do_create
|
||||
post :create, :session => {
|
||||
|
@@ -8,7 +8,7 @@ describe SoundsController do
|
||||
end
|
||||
|
||||
describe 'GET show' do
|
||||
let(:sound) { Factory.create(:sound) }
|
||||
let(:sound) { FactoryGirl.create(:sound) }
|
||||
|
||||
def do_show
|
||||
get :show, :id => sound.id
|
||||
|
@@ -9,7 +9,7 @@ describe TracksController do
|
||||
|
||||
describe 'GET show' do
|
||||
it 'assigns the requested track as @track' do
|
||||
track = Factory.create(:track)
|
||||
track = FactoryGirl.create(:track)
|
||||
get :show, :id => track.id.to_s
|
||||
assigns[:track].should == track
|
||||
end
|
||||
@@ -24,7 +24,7 @@ describe TracksController do
|
||||
|
||||
describe 'POST create new' do
|
||||
def do_create
|
||||
post :create, :track => Factory.attributes_for(:track).merge({
|
||||
post :create, :track => FactoryGirl.attributes_for(:track).merge({
|
||||
:file => fixture_file_upload(
|
||||
"#{Rails.root}/spec/fixtures/test.mp3",
|
||||
'audio/mpeg'
|
||||
|
@@ -12,17 +12,17 @@ describe UsersController do
|
||||
context 'whith valid params' do
|
||||
it 'creates a new user' do
|
||||
expect {
|
||||
post :create, :user => Factory.attributes_for(:user)
|
||||
post :create, :user => FactoryGirl.attributes_for(:user)
|
||||
}.to change(User, :count).by(1)
|
||||
end
|
||||
|
||||
it 'signs the user in' do
|
||||
post :create, :user => Factory.attributes_for(:user)
|
||||
post :create, :user => FactoryGirl.attributes_for(:user)
|
||||
controller.current_user.should_not be_nil
|
||||
end
|
||||
|
||||
it 'redirects to the home page' do
|
||||
post :create, :user => Factory.attributes_for(:user)
|
||||
post :create, :user => FactoryGirl.attributes_for(:user)
|
||||
response.should redirect_to(:root)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user