Sha256: 875650a369cf7b14f9a8c66270eb80e4a872d280bbf6abbffafbe8dd63827e77
Contents?: true
Size: 1.77 KB
Versions: 8
Compression:
Stored size: 1.77 KB
Contents
require_relative '../../spec_helper' require_lib 'reek/report/code_climate_formatter' RSpec.describe Reek::Report::CodeClimateFormatter, '#to_hash' do it "sets the type as 'issue'" do warning = FactoryGirl.build(:smell_warning) issue = Reek::Report::CodeClimateFormatter.new(warning) result = issue.to_hash expect(result).to include(type: 'issue') end it 'sets the category' do warning = FactoryGirl.build(:smell_warning) issue = Reek::Report::CodeClimateFormatter.new(warning) result = issue.to_hash expect(result).to include(categories: ['Complexity']) end it 'constructs a description based on the context and message' do warning = FactoryGirl.build(:smell_warning, context: 'context foo', message: 'message bar') issue = Reek::Report::CodeClimateFormatter.new(warning) result = issue.to_hash expect(result).to include( description: 'context foo message bar') end it 'sets a check name based on the smell detector' do warning = FactoryGirl.build(:smell_warning, smell_detector: Reek::Smells::UtilityFunction.new) issue = Reek::Report::CodeClimateFormatter.new(warning) result = issue.to_hash expect(result).to include(check_name: 'LowCohesion/UtilityFunction') end it 'sets the location' do warning = FactoryGirl.build(:smell_warning, lines: [1, 2], source: 'a/ruby/source/file.rb') issue = Reek::Report::CodeClimateFormatter.new(warning) result = issue.to_hash expect(result).to include( location: { path: 'a/ruby/source/file.rb', lines: { begin: 1, end: 2 } } ) end end
Version data entries
8 entries across 8 versions & 1 rubygems