Sha256: 508ff4707cad1cb2e5270cb49edf21f5d41b7d2afb4eabebcb8b684cd5f89f46
Contents?: true
Size: 983 Bytes
Versions: 6
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
6 entries across 6 versions & 1 rubygems