2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_helper'
|
2014-07-25 01:22:29 -04:00
|
|
|
require_dependency 'badge'
|
|
|
|
|
|
|
|
describe Badge do
|
2014-12-31 09:55:03 -05:00
|
|
|
it { is_expected.to belong_to(:badge_type) }
|
|
|
|
it { is_expected.to belong_to(:badge_grouping) }
|
|
|
|
it { is_expected.to have_many(:user_badges).dependent(:destroy) }
|
|
|
|
|
|
|
|
it { is_expected.to validate_presence_of(:name) }
|
|
|
|
it { is_expected.to validate_presence_of(:badge_type) }
|
|
|
|
it { is_expected.to validate_uniqueness_of(:name) }
|
2014-07-25 01:22:29 -04:00
|
|
|
|
|
|
|
it 'has a valid system attribute for new badges' do
|
2014-12-31 09:55:03 -05:00
|
|
|
expect(Badge.create!(name: "test", badge_type_id: 1).system?).to be false
|
2014-07-25 01:22:29 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|