spec/danger_plugin_spec.rb in danger-rubocop-0.7.2 vs spec/danger_plugin_spec.rb in danger-rubocop-0.8.0
- old
+ new
@@ -144,11 +144,11 @@
}.to_json
end
it 'handles a rubocop report for specified files' do
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json --config path/to/rubocop.yml spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types --config path/to/rubocop.yml spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
# Do it
@rubocop.lint(files: 'spec/fixtures/ruby*.rb', config: 'path/to/rubocop.yml')
@@ -160,11 +160,11 @@
expect(output).to include("spec/fixtures/ruby_file.rb | 13 | Don't do that!")
end
it 'includes cop names when include_cop_names is set' do
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json --config path/to/rubocop.yml spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types --config path/to/rubocop.yml spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
# Do it
@rubocop.lint(files: 'spec/fixtures/ruby*.rb', config: 'path/to/rubocop.yml', include_cop_names: true)
@@ -176,11 +176,11 @@
expect(output).to include("spec/fixtures/ruby_file.rb | 13 | Syntax/WhetherYouShouldDoThat: Don't do that!")
end
it 'handles a rubocop report for specified files (legacy)' do
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
# Do it
@rubocop.lint('spec/fixtures/ruby*.rb')
@@ -192,11 +192,11 @@
expect(output).to include("spec/fixtures/ruby_file.rb | 13 | Don't do that!")
end
it 'appends --force-exclusion argument when force_exclusion is set' do
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json --force-exclusion spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types --force-exclusion spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
# Do it
@rubocop.lint(files: 'spec/fixtures/ruby*.rb', force_exclusion: true)
@@ -212,11 +212,11 @@
allow(@rubocop.git).to receive(:added_files).and_return([])
allow(@rubocop.git).to receive(:modified_files)
.and_return(["spec/fixtures/another_ruby_file.rb"])
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json spec/fixtures/another_ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types spec/fixtures/another_ruby_file.rb')
.and_return(response_another_ruby_file)
@rubocop.lint
output = @rubocop.status_report[:markdowns].first.message
@@ -228,11 +228,11 @@
it 'is formatted as a markdown table' do
allow(@rubocop.git).to receive(:modified_files)
.and_return(['spec/fixtures/ruby_file.rb'])
allow(@rubocop.git).to receive(:added_files).and_return([])
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
@rubocop.lint
formatted_table = <<-EOS
@@ -250,33 +250,33 @@
it 'reports violations as line by line warnings' do
allow(@rubocop.git).to receive(:modified_files)
.and_return(['spec/fixtures/ruby_file.rb'])
allow(@rubocop.git).to receive(:added_files).and_return([])
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
@rubocop.lint(inline_comment: true)
expect(@rubocop.violation_report[:warnings].first.to_s)
- .to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13 }")
+ .to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13, type: warning }")
end
end
context 'with fail_on_inline_comment option' do
it 'reports violations as line by line failures' do
allow(@rubocop.git).to receive(:modified_files)
.and_return(['spec/fixtures/ruby_file.rb'])
allow(@rubocop.git).to receive(:added_files).and_return([])
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
@rubocop.lint(fail_on_inline_comment: true, inline_comment: true)
expect(@rubocop.violation_report[:errors].first.to_s)
- .to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13 }")
+ .to eq("Violation Don't do that! { sticky: false, file: spec/fixtures/ruby_file.rb, line: 13, type: error }")
end
end
end
describe 'a filename with special characters' do
@@ -299,10 +299,10 @@
it 'reports to danger' do
allow(@rubocop.git).to receive(:modified_files)
.and_return(['spec/fixtures/ruby_file.rb'])
allow(@rubocop.git).to receive(:added_files).and_return([])
allow(@rubocop).to receive(:`)
- .with('bundle exec rubocop -f json spec/fixtures/ruby_file.rb')
+ .with('bundle exec rubocop -f json --only-recognized-file-types spec/fixtures/ruby_file.rb')
.and_return(response_ruby_file)
expect(@rubocop).to receive(:fail).with(fail_msg)
@rubocop.lint(report_danger: true)
end