Update factory girl to last version

This commit is contained in:
Thibault Jouan
2014-04-01 05:04:27 +00:00
parent d2b332215e
commit eda2f3fbee
28 changed files with 56 additions and 56 deletions

View File

@@ -2,7 +2,7 @@ require 'spec_helper'
describe Playlist do
subject { playlist }
let(:playlist) { Factory.build(:playlist) }
let(:playlist) { FactoryGirl.build(:playlist) }
it { should be_valid }
it { should belong_to :user }

View File

@@ -2,7 +2,7 @@ require 'spec_helper'
describe Sound do
subject { sound }
let(:sound) { Factory.build(:sound) }
let(:sound) { FactoryGirl.build(:sound) }
it { should be_valid }
it { should belong_to :track }
@@ -20,7 +20,7 @@ describe Sound do
end
describe '#file=' do
let (:file) { Factory.attributes_for(:sound)[:file] }
let (:file) { FactoryGirl.attributes_for(:sound)[:file] }
it 'saves the file SHA256 digest' do
sound.sha256.should == Digest::SHA256.file(file.path).hexdigest

View File

@@ -2,8 +2,8 @@ require 'spec_helper'
describe Track do
subject { track }
let(:track) { Factory.build(:track) }
let(:file) { Factory.attributes_for(:track_with_sound)[:file] }
let(:track) { FactoryGirl.build(:track) }
let(:file) { FactoryGirl.attributes_for(:track_with_sound)[:file] }
it { should be_valid }
it { should have_many :sounds }
@@ -34,7 +34,7 @@ describe Track do
describe '#sound' do
context 'with a sound' do
before do
track.sounds << Factory.create(:sound)
track.sounds << FactoryGirl.create(:sound)
end
it 'returns a sound' do
@@ -52,7 +52,7 @@ describe Track do
context 'with a sound' do
before do
track.sounds << Factory.create(:sound)
track.sounds << FactoryGirl.create(:sound)
end
it 'returns true' do
@@ -63,8 +63,8 @@ describe Track do
describe '.latest' do
it 'returns latest tracks in descending creation date order' 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')
Track.latest.should == [track2, track1]
end
end

View File

@@ -2,7 +2,7 @@ require 'spec_helper'
describe User do
subject { user }
let(:user) { Factory.build(:user) }
let(:user) { FactoryGirl.build(:user) }
it { should be_valid }
it { should have_many :playlists }
@@ -12,8 +12,8 @@ describe User do
it { should_not allow_mass_assignment_of :password_hash }
context 'when a user with the same email address already exists' do
let(:old_user) { Factory.create(:user, :email => 'unique@example.net') }
subject { Factory.build(:user, :email => old_user.email) }
let(:old_user) { FactoryGirl.create(:user, :email => 'unique@example.net') }
subject { FactoryGirl.build(:user, :email => old_user.email) }
it { should_not be_valid }