gitlab-org--gitlab-foss/spec/models/protected_branch_spec.rb

43 lines
983 B
Ruby
Raw Normal View History

2012-10-09 04:14:17 -04:00
# == Schema Information
#
# Table name: protected_branches
#
2012-11-19 13:24:05 -05:00
# id :integer not null, primary key
# project_id :integer not null
# name :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
2012-10-09 04:14:17 -04:00
#
require 'spec_helper'
describe ProtectedBranch do
2012-05-10 18:43:12 -04:00
describe 'Associations' do
it { should belong_to(:project) }
end
describe "Mass assignment" do
it { should_not allow_mass_assignment_of(:project_id) }
end
2012-05-10 18:43:12 -04:00
describe 'Validation' do
2012-10-08 20:10:16 -04:00
it { should validate_presence_of(:project) }
2012-05-10 18:43:12 -04:00
it { should validate_presence_of(:name) }
end
describe 'Callbacks' do
let(:branch) { build(:protected_branch) }
2012-05-10 18:43:12 -04:00
it 'call update_repository after save' do
branch.should_receive(:update_repository)
branch.save
2012-05-10 18:43:12 -04:00
end
it 'call update_repository after destroy' do
branch.save
branch.should_receive(:update_repository)
branch.destroy
2012-05-10 18:43:12 -04:00
end
end
end