Commit e55d7b67 authored by Thong Kuah's avatar Thong Kuah Committed by Albert Salim

Assert different warning type has no offense

parent c827aab2
...@@ -38,6 +38,8 @@ RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do ...@@ -38,6 +38,8 @@ RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do
- | - |
DEPRECATION WARNING: /Users/tkuah/code/ee-gdk/gitlab/create_service.rb:1: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call DEPRECATION WARNING: /Users/tkuah/code/ee-gdk/gitlab/create_service.rb:1: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
/Users/tkuah/code/ee-gdk/gitlab/user.rb:17: warning: The called method `call' is defined here /Users/tkuah/code/ee-gdk/gitlab/user.rb:17: warning: The called method `call' is defined here
- |
DEPRECATION WARNING: /Users/tkuah/code/ee-gdk/gitlab/other_warning_type.rb:1: warning: Some other warning type
YAML YAML
end end
...@@ -62,7 +64,7 @@ RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do ...@@ -62,7 +64,7 @@ RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do
allow(File).to receive(:read).and_return(create_spec_yaml, projects_spec_yaml) allow(File).to receive(:read).and_return(create_spec_yaml, projects_spec_yaml)
end end
it 'registers an offense' do it 'registers an offense for last keyword warning' do
expect_offense(<<~SOURCE, 'create_service.rb') expect_offense(<<~SOURCE, 'create_service.rb')
users.call(params) users.call(params)
^^^^^^ Using the last argument as keyword parameters is deprecated ^^^^^^ Using the last argument as keyword parameters is deprecated
...@@ -73,6 +75,12 @@ RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do ...@@ -73,6 +75,12 @@ RSpec.describe RuboCop::Cop::Lint::LastKeywordArgument do
SOURCE SOURCE
end end
it 'does not register an offense for other warning types' do
expect_no_offenses(<<~SOURCE, 'other_warning_type.rb')
users.call(params)
SOURCE
end
it 'registers an offense for the new method call' do it 'registers an offense for the new method call' do
expect_offense(<<~SOURCE, 'projects_spec.rb') expect_offense(<<~SOURCE, 'projects_spec.rb')
Project.new(params) Project.new(params)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment