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

@@ -11,9 +11,7 @@ describe Track do
it { should_not allow_mass_assignment_of :sounds }
context 'with a file' do
before do
track.file = file
end
before { track.file = file }
it { should be_valid }
@@ -35,9 +33,7 @@ describe Track do
describe '#sound' do
context 'with a sound' do
before do
track.sounds << FactoryGirl.create(:sound)
end
before { track.sounds << FactoryGirl.create(:sound) }
it 'returns a sound' do
expect(track.sound).to be_a Sound
@@ -53,9 +49,7 @@ describe Track do
end
context 'with a sound' do
before do
track.sounds << FactoryGirl.create(:sound)
end
before { track.sounds << FactoryGirl.create(:sound) }
it 'returns true' do
expect(track.sound?).to be true

View File

@@ -21,9 +21,7 @@ describe User do
end
context 'when password_confirmation does not match password' do
before do
user.password_confirmation = user.password + 'INVALID'
end
before { user.password_confirmation = user.password + 'INVALID' }
it { should_not be_valid }
end