Skip to content

Commit

Permalink
Add test for ignored_method
Browse files Browse the repository at this point in the history
Adds a unit test that executes the `ignored_method?` check
https://github.com/testdouble/standard/blob/master/lib/standard/cop/semantic_blocks.rb#L105

The methods that are ignored are configured as part of the cop
SemanticBlocks configuration.
[/config/base.yml](https://github.com/testdouble/standard/blob/f6896ac8d79a5697d73ba1b80f60449698bbed86/config/base.yml#L671)

Test coverage:

Before: 710 / 721 LOC (98.47%) covered.
After: 713 / 723 LOC (98.62%) covered.

(The extra 2 lines here are due to the test files themselves being
included in the coverage report. Whether this is a good thing is a
separate question.)
  • Loading branch information
Insti committed Oct 22, 2019
1 parent d59935b commit 3c856c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/standard/cop/semantic_blocks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,12 @@ def test_method_with_arguments_without_parentheses_multi_line_block_curly_braces
}
RUBY
end

def test_accepts_a_multiline_functional_block_with_do_end_if_it_is_an_ignored_method
assert_no_offense @cop, <<-RUBY
foo = lambda do
puts 42
end
RUBY
end
end

0 comments on commit 3c856c0

Please sign in to comment.