mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-30 16:04:36 -04:00
FIX: system attribute not set correctly on new badges
This commit is contained in:
parent
40af9ce612
commit
354d40a6ea
3 changed files with 12 additions and 16 deletions
|
@ -206,7 +206,7 @@ SQL
|
||||||
end
|
end
|
||||||
|
|
||||||
def system?
|
def system?
|
||||||
id < 100
|
id && id < 100
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_name=(val)
|
def default_name=(val)
|
||||||
|
|
|
@ -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
11
spec/models/badge_spec.rb
Normal 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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue