Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

plugins:
- rubocop-sorbet
- rubocop-minitest

inherit_gem:
rubocop-shopify: rubocop.yml
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ group :development do
gem "debug"
gem "rubocop-shopify", require: false
gem "rubocop-sorbet", require: false
gem "rubocop-minitest", require: false
gem "tapioca", require: false
end
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ GEM
rubocop-ast (1.49.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-minitest (0.38.1)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-shopify (2.18.0)
rubocop (~> 1.62)
rubocop-sorbet (0.12.0)
Expand Down Expand Up @@ -137,6 +141,7 @@ DEPENDENCIES
minitest-mock
minitest-reporters
rake (~> 13.4.2)
rubocop-minitest
rubocop-shopify
rubocop-sorbet
spoom!
Expand Down
7 changes: 7 additions & 0 deletions test/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
inherit_from: ../.rubocop.yml

Minitest/AssertPredicate:
Enabled: true

Minitest/LiteralAsActualArgument:
Enabled: true
6 changes: 3 additions & 3 deletions test/spoom/context/git_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_context_git_commit!
res = context.git_commit!

assert(res.status)
assert(context.git_workdir_clean?)
assert_predicate(context, :git_workdir_clean?)
assert(context.file?("b"))

context.destroy!
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_context_git_last_commit
assert(sha.size < 40)

sha = T.must(context.git_last_commit(short_sha: false)).sha
assert(sha.size == 40)
assert_equal(40, sha.size)

last_commit = context.git_last_commit
assert_equal(time.to_i, last_commit&.timestamp)
Expand Down Expand Up @@ -242,7 +242,7 @@ def test_context_clean_workdir_on_clean_repo
context.write!("file")
context.git_commit!

assert(context.git_workdir_clean?)
assert_predicate(context, :git_workdir_clean?)

context.destroy!
end
Expand Down
2 changes: 1 addition & 1 deletion test/spoom/context/sorbet_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test_context_has_sorbet_config
refute(context.has_sorbet_config?)

context.write_sorbet_config!(".")
assert(context.has_sorbet_config?)
assert_predicate(context, :has_sorbet_config?)

context.destroy!
end
Expand Down
4 changes: 2 additions & 2 deletions test/spoom/context_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module Sorbet
class ContextTest < Minitest::Test
def test_context_mktmp!
context = Context.mktmp!
assert(context.exist?)
assert_predicate(context, :exist?)
context.destroy!
end

def test_context_make!
context = Context.new("/tmp/spoom-context-test")
refute(context.exist?)
context.mkdir!
assert(context.exist?)
assert_predicate(context, :exist?)
context.destroy!
refute(context.exist?)
end
Expand Down
2 changes: 1 addition & 1 deletion test/spoom/deadcode/index_references_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def foo(&block)
when "[]", "!"
next
else
assert(ref.name =~ /^m(\d+)(=)?$/)
assert_match(/^m(\d+)(=)?$/, ref.name)
end
end
end
Expand Down
34 changes: 17 additions & 17 deletions test/spoom/location_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,39 @@ def test_raises_if_initialize_has_missing_attributes
def test_include
location1 = Location.new("foo.rb", start_line: 1, start_column: 2, end_line: 3, end_column: 4)
location2 = Location.new("foo.rb", start_line: 1, start_column: 2, end_line: 3, end_column: 4)
assert(location1.include?(location2))
assert_includes(location1, location2)

location3 = Location.new("foo.rb", start_line: 1, start_column: 2, end_line: 3, end_column: 5)
refute(location1.include?(location3))
assert(location3.include?(location1))
refute_includes(location1, location3)
assert_includes(location3, location1)

location4 = Location.new("foo.rb", start_line: 1, start_column: 2, end_line: 4, end_column: 4)
refute(location1.include?(location4))
assert(location4.include?(location1))
refute_includes(location1, location4)
assert_includes(location4, location1)

location5 = Location.new("foo.rb", start_line: 1, start_column: 3, end_line: 3, end_column: 4)
assert(location1.include?(location5))
refute(location5.include?(location1))
assert_includes(location1, location5)
refute_includes(location5, location1)

location6 = Location.new("foo.rb", start_line: 2, start_column: 2, end_line: 3, end_column: 4)
assert(location1.include?(location6))
refute(location6.include?(location1))
assert_includes(location1, location6)
refute_includes(location6, location1)

location7 = Location.new("bar.rb", start_line: 1, start_column: 2, end_line: 3, end_column: 4)
refute(location1.include?(location7))
refute(location7.include?(location1))
refute_includes(location1, location7)
refute_includes(location7, location1)

location8 = Location.new("foo.rb")
location9 = Location.new("foo.rb")
assert(location8.include?(location9))
assert(location9.include?(location8))
assert_includes(location8, location9)
assert_includes(location9, location8)

assert(location8.include?(location1))
refute(location1.include?(location8))
assert_includes(location8, location1)
refute_includes(location1, location8)

location10 = Location.new("foo.rb", start_line: 1, end_line: 3)
assert(location10.include?(location1))
refute(location1.include?(location10))
assert_includes(location10, location1)
refute_includes(location1, location10)
end

def test_comparison
Expand Down
2 changes: 1 addition & 1 deletion test/spoom/model/references_visitor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def foo(&block)
assert_equal(51, refs.size) # 49 + 2 (including `[]` and `!`)

refs.each do |ref|
assert(ref =~ /^(m(\d+)(=)?)|\[\]|!$/)
assert_match(/^(m(\d+)(=)?)|\[\]|!$/, ref)
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/spoom/sorbet/sigils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class A; end

new_content = Sigils.update_sigil(content, "true")

assert(/^# typed: ignore$/.match?(new_content))
assert_match(/^# typed: ignore$/, new_content)

strictness = Sigils.strictness_in_content(new_content)

Expand Down
Loading