Specify models attributes that must not be mass assignated
This commit is contained in:
parent
5e6781a656
commit
5145717a3c
@ -1,6 +1,8 @@
|
||||
class Playlist < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
|
||||
attr_accessible :name
|
||||
|
||||
validates_presence_of :user
|
||||
validates_presence_of :name
|
||||
end
|
||||
|
@ -8,4 +8,5 @@ describe Playlist do
|
||||
it { should belong_to :user }
|
||||
it { should validate_presence_of :user }
|
||||
it { should validate_presence_of :name }
|
||||
it { should_not allow_mass_assignment_of :user }
|
||||
end
|
||||
|
@ -8,6 +8,7 @@ describe Track do
|
||||
it { should be_valid }
|
||||
it { should have_many :sounds }
|
||||
it { should validate_presence_of :name }
|
||||
it { should_not allow_mass_assignment_of :sounds }
|
||||
|
||||
context 'with a file' do
|
||||
before do
|
||||
|
@ -9,6 +9,7 @@ describe User do
|
||||
it { should validate_presence_of :email }
|
||||
it { should validate_presence_of :password }
|
||||
it { should validate_presence_of :password_hash }
|
||||
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') }
|
||||
|
Loading…
x
Reference in New Issue
Block a user