Sha256: 0bbd35f9d3370bc8ac7df1df5edd57446e76bc46b0e3d78b4944741bfc8e1bff

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  it 'finds description with `should` at the beginning' do
    inspect_source(cop, ["it 'should do something' do", 'end'])
    expect(cop.offenses.size).to eq(1)
    expect(cop.offenses.map(&:line).sort).to eq([1])
    expect(cop.messages)
      .to eq(['Do not use should when describing your tests.'])
    expect(cop.highlights).to eq(['it'])
  end

  it 'skips descriptions without `should` at the beginning' do
    inspect_source(cop, ["it 'finds no should ' \\",
                         "   'here' 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_example_wording_spec.rb
rubocop-rspec-1.0.rc1 spec/rubocop/cop/rspec_example_wording_spec.rb