2014-03-05 07:52:20 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
require_dependency 'badge'
|
|
|
|
|
|
|
|
describe Badge do
|
|
|
|
|
|
|
|
it { should belong_to :badge_type }
|
2014-03-21 08:26:06 -04:00
|
|
|
it { should have_many(:user_badges).dependent(:destroy) }
|
2014-03-05 07:52:20 -05:00
|
|
|
|
|
|
|
context 'validations' do
|
|
|
|
before(:each) { Fabricate(:badge) }
|
|
|
|
|
|
|
|
it { should validate_presence_of :name }
|
|
|
|
it { should validate_presence_of :badge_type }
|
|
|
|
it { should validate_uniqueness_of :name }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|