Fix coding standards in specs
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
describe Playlist do
|
||||
subject { playlist }
|
||||
let(:playlist) { build :playlist }
|
||||
subject(:playlist) { build :playlist }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
it { is_expected.to belong_to :user }
|
||||
|
@@ -1,6 +1,5 @@
|
||||
describe Sound do
|
||||
subject { sound }
|
||||
let(:sound) { build :sound }
|
||||
subject(:sound) { build :sound }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
it { is_expected.to belong_to :track }
|
||||
|
@@ -1,7 +1,6 @@
|
||||
describe Track do
|
||||
subject { track }
|
||||
let(:track) { build :track }
|
||||
let(:file) { attributes_for(:track_with_sound)[:file] }
|
||||
let(:file) { attributes_for(:track_with_sound)[:file] }
|
||||
subject(:track) { build :track }
|
||||
|
||||
it { is_expected.to be_valid }
|
||||
it { is_expected.to have_many :sounds }
|
||||
@@ -13,9 +12,15 @@ describe Track do
|
||||
it { is_expected.to be_valid }
|
||||
|
||||
it 'creates a sound for the track' do
|
||||
expect {
|
||||
track.save
|
||||
}.to change(track.sounds, :count).by(1)
|
||||
expect { track.save }.to change(track.sounds, :count).by 1
|
||||
end
|
||||
end
|
||||
|
||||
describe '.latest' do
|
||||
it 'returns latest tracks in descending creation date order' do
|
||||
track1 = create :track, created_at: '2011-07-27 19:13:42'
|
||||
track2 = create :track, created_at: '2011-07-27 19:58:57'
|
||||
expect(described_class.latest).to eq [track2, track1]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,7 +28,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
|
||||
@@ -53,12 +58,4 @@ describe Track do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '.latest' do
|
||||
it 'returns latest tracks in descending creation date order' do
|
||||
track1 = create :track, created_at: '2011-07-27 19:13:42'
|
||||
track2 = create :track, created_at: '2011-07-27 19:58:57'
|
||||
expect(Track.latest).to eq [track2, track1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -11,7 +11,7 @@ describe User do
|
||||
let(:old_user) { create :user, email: 'unique@example.net' }
|
||||
subject(:user) { build :user, email: old_user.email }
|
||||
|
||||
it { is_expected.to_not be_valid }
|
||||
it { is_expected.not_to be_valid }
|
||||
|
||||
it 'has an error on email attribute' do
|
||||
user.valid?
|
||||
@@ -22,7 +22,7 @@ describe User do
|
||||
context 'when password_confirmation does not match password' do
|
||||
before { user.password_confirmation = user.password + 'INVALID' }
|
||||
|
||||
it { is_expected.to_not be_valid }
|
||||
it { is_expected.not_to be_valid }
|
||||
end
|
||||
|
||||
describe '#password=' do
|
||||
@@ -34,13 +34,13 @@ describe User do
|
||||
describe '#authenticate?' do
|
||||
context 'with a valid password' do
|
||||
it 'returns true' do
|
||||
expect(user.authenticate?(user.password)).to be true
|
||||
expect(user.authenticate? user.password).to be true
|
||||
end
|
||||
end
|
||||
|
||||
context 'with an invalid password' do
|
||||
it 'returns false' do
|
||||
expect(user.authenticate?(user.password + '_INVALID')).to be false
|
||||
expect(user.authenticate? user.password + '_INVALID').to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user