Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark methods called by ActiveSupport::TestCase.setup as alive
Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
require "test_with_project" | ||
require "helpers/deadcode_helper" | ||
|
||
module Spoom | ||
module Deadcode | ||
module Plugins | ||
class ActiveSupportTest < TestWithProject | ||
include Test::Helpers::DeadcodeHelper | ||
|
||
def test_ignore_minitest_setup_and_teardown_with_symbols | ||
@project.write!("test/foo_test.rb", <<~RB) | ||
class FooTest | ||
setup(:alive1, :alive2) | ||
teardown(:alive3) | ||
def alive1; end | ||
def alive2; end | ||
def alive3; end | ||
def dead; end | ||
end | ||
RB | ||
|
||
index = index_with_plugins | ||
assert_alive(index, "alive1") | ||
assert_alive(index, "alive2") | ||
assert_alive(index, "alive3") | ||
assert_dead(index, "dead") | ||
end | ||
|
||
private | ||
|
||
sig { returns(Index) } | ||
def index_with_plugins | ||
deadcode_index(plugins: [ActiveSupport.new]) | ||
end | ||
end | ||
end | ||
end | ||
end |