FIX: system attribute not set correctly on new badges

This commit is contained in:
Sam 2014-07-25 15:22:29 +10:00
parent 40af9ce612
commit 354d40a6ea
3 changed files with 12 additions and 16 deletions

View File

@ -206,7 +206,7 @@ SQL
end
def system?
id < 100
id && id < 100
end
def default_name=(val)

View File

@ -1,15 +0,0 @@
require 'spec_helper'
require_dependency 'badge'
describe Badge do
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

11
spec/models/badge_spec.rb Normal file
View File

@ -0,0 +1,11 @@
require 'spec_helper'
require_dependency 'badge'
describe Badge do
it 'has a valid system attribute for new badges' do
Badge.new.system?.should be_false
end
end