Sha256: 339e1c6e4183818c70204cf1fbc0a6d2bfecc35476510763286288813afd3da9
Contents?: true
Size: 983 Bytes
Versions: 13
Compression:
Stored size: 983 Bytes
Contents
# encoding: utf-8 require 'spec_helper' describe RuboCop::Cop::Lint::Syntax do describe '.offense_from_diagnostic' do subject(:offense) { described_class.offense_from_diagnostic(diagnostic) } let(:diagnostic) { Parser::Diagnostic.new(level, reason, args, location) } let(:level) { :warning } let(:reason) { :odd_hash } let(:args) { [] } let(:location) { double('location').as_null_object } it 'returns an offense' do expect(offense).to be_a(RuboCop::Cop::Offense) end it "sets diagnostic's level to offense's severity" do expect(offense.severity).to eq(level) end it "sets diagnostic's message to offense's message" do expect(offense.message).to eq('odd number of entries for a hash') end it "sets diagnostic's location to offense's location" do expect(offense.location).to eq(location) end it 'sets Syntax as a cop name' do expect(offense.cop_name).to eq('Syntax') end end end
Version data entries
13 entries across 13 versions & 2 rubygems