Sha256: 5694bd348f1d3547da2fa424ebb23895445c91b320e19982a6e040a4f90b38b5

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Rubocop::Cop::RSpecDescribeMethod do
  subject(:cop) { described_class.new }

  it 'enforces non-method names' do
    inspect_source(cop, ["describe Some::Class, 'nope' do; end"])
    expect(cop.offenses.size).to eq(1)
    expect(cop.offenses.map(&:line).sort).to eq([1])
    expect(cop.messages)
    .to eq(['The second argument to describe should be the method being ' \
            "tested. '#instance' or '.class'"])
  end

  it 'skips methods starting with a . or #' do
    inspect_source(cop, ["describe Some::Class, '.asdf' do; end",
                         "describe Some::Class, '#fdsa' do; end"])
    expect(cop.offenses).to be_empty
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-rspec-1.0.rc2 spec/rubocop/cop/rspec_describe_method_spec.rb
rubocop-rspec-1.0.rc1 spec/rubocop/cop/rspec_describe_method_spec.rb