Skip to content

Commit 9bf4235

Browse files
authored
Merge pull request #1771 from codidact/0valt/codecov
Test coverage improvements
2 parents 04c3643 + b22cdee commit 9bf4235

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

.github/.codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ component_management:
3535
name: models
3636
paths:
3737
- app/models/**
38+
- component_id: module_tasks
39+
name: tasks
40+
paths:
41+
- app/tasks/**

app/models/category.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def update_activity(last_activity)
6262

6363
# Gets categories appropriately scoped for a given user
6464
# @param user [User] user to check
65-
# @return [ActiveRecord::Relation<category>]
65+
# @return [ActiveRecord::Relation<Category>]
6666
def self.accessible_to(user)
6767
if user&.at_least_moderator?
6868
return Category.all

test/models/blocked_item_test.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
require 'test_helper'
22

33
class BlockedItemTest < ActiveSupport::TestCase
4-
# test "the truth" do
5-
# assert true
6-
# end
4+
test 'predicates should correctly check item type' do
5+
['email', 'ip'].each do |type|
6+
assert blocked_items(type.to_sym).send("#{type}?")
7+
end
8+
end
79
end

test/models/category_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ class CategoryTest < ActiveSupport::TestCase
1818
assert cat.name.include?('Trust')
1919
end
2020
end
21+
22+
test 'public? should correctly determine category visibility' do
23+
assert categories(:main).public?
24+
assert_not categories(:admin_only).public?
25+
end
2126
end

test/models/license_test.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
require 'test_helper'
22

33
class LicenseTest < ActiveSupport::TestCase
4-
# test "the truth" do
5-
# assert true
6-
# end
4+
test 'site_default should correctly get the default license' do
5+
defaults = licenses.select(&:default?)
6+
assert defaults.include?(License.site_default)
7+
end
78
end

test/models/post_type_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
require 'test_helper'
2+
3+
class PostTypeTest < ActiveSupport::TestCase
4+
test 'system? should correctly determine if a type is a system type' do
5+
assert_not post_types(:question).system?
6+
assert post_types(:policy_doc).system?
7+
assert post_types(:help_doc).system?
8+
end
9+
end

0 commit comments

Comments
 (0)