Skip to content

Commit

Permalink
Add more test cases for TernaryParentheses cop
Browse files Browse the repository at this point in the history
Add tests for the TernaryParentheses cop to cover the case that was
failing in rubocop#3687.
It has already been fixed but there were no tests for this case.
  • Loading branch information
Ana06 committed Nov 20, 2016
1 parent 9128852 commit c4134b6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec/rubocop/cop/style/ternary_parentheses_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
'foo = bar && baz ? a : b',
'foo = (bar && baz) ? a : b'

it_behaves_like 'code with offense',
'foo = foo1 == foo2 ? a : b',
'foo = (foo1 == foo2) ? a : b'

it_behaves_like 'code with offense',
'foo = bar.baz? ? a : b',
'foo = (bar.baz?) ? a : b'
Expand Down Expand Up @@ -101,6 +105,9 @@
'foo = (1 + 1 == 2) ? a : b',
'foo = 1 + 1 == 2 ? a : b'

it_behaves_like 'code with offense',
'foo = (foo1 == foo2) ? a : b'

it_behaves_like 'code with offense',
'foo = (bar && baz) ? a : b',
'foo = bar && baz ? a : b'
Expand Down

0 comments on commit c4134b6

Please sign in to comment.