2015-10-11 04:41:23 -05:00
|
|
|
require 'rails_helper'
|
2014-07-25 00:22:29 -05:00
|
|
|
require_dependency 'badge'
|
|
|
|
|
|
|
|
describe Badge do
|
2014-12-31 08:55:03 -06: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 00:22:29 -05:00
|
|
|
|
|
|
|
it 'has a valid system attribute for new badges' do
|
2014-12-31 08:55:03 -06:00
|
|
|
expect(Badge.create!(name: "test", badge_type_id: 1).system?).to be false
|
2014-07-25 00:22:29 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|