Skip to content
4 changes: 4 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ component_management:
name: models
paths:
- app/models/**
- component_id: module_tasks
name: tasks
paths:
- app/tasks/**
2 changes: 1 addition & 1 deletion app/models/category.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def update_activity(last_activity)

# Gets categories appropriately scoped for a given user
# @param user [User] user to check
# @return [ActiveRecord::Relation<category>]
# @return [ActiveRecord::Relation<Category>]
def self.accessible_to(user)
if user&.at_least_moderator?
return Category.all
Expand Down
8 changes: 5 additions & 3 deletions test/models/blocked_item_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'test_helper'

class BlockedItemTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
test 'predicates should correctly check item type' do
['email', 'ip'].each do |type|
assert blocked_items(type.to_sym).send("#{type}?")
end
end
end
5 changes: 5 additions & 0 deletions test/models/category_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ class CategoryTest < ActiveSupport::TestCase
assert cat.name.include?('Trust')
end
end

test 'public? should correctly determine category visibility' do
assert categories(:main).public?
assert_not categories(:admin_only).public?
end
end
7 changes: 4 additions & 3 deletions test/models/license_test.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require 'test_helper'

class LicenseTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
test 'site_default should correctly get the default license' do
defaults = licenses.select(&:default?)
assert defaults.include?(License.site_default)
end
end
9 changes: 9 additions & 0 deletions test/models/post_type_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'test_helper'

class PostTypeTest < ActiveSupport::TestCase
test 'system? should correctly determine if a type is a system type' do
assert_not post_types(:question).system?
assert post_types(:policy_doc).system?
assert post_types(:help_doc).system?
end
end