Sha256: 01f243e2392d09bfc1a0e2abdc053ca39df2feeb70e75e8b7e24b7663a94a7d2

Contents?: true

Size: 720 Bytes

Versions: 4

Compression:

Stored size: 720 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe RuboCop::Cop::RSpec::ExampleWording 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

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-rspec-1.1.0 spec/rubocop/cop/rspec/example_wording_spec.rb
rubocop-rspec-1.0.1 spec/rubocop/cop/rspec/example_wording_spec.rb
rubocop-rspec-1.0 spec/rubocop/cop/rspec/example_wording_spec.rb
rubocop-rspec-1.0.rc3 spec/rubocop/cop/rspec/example_wording_spec.rb