Created
September 19, 2019 13:51
-
-
Save urbanautomaton/7b073e7a98846eaf08a6ab49fcc144d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'rubocop' | |
require 'rubocop/rspec/cop_helper' | |
require 'support/rubocop/expect_offense' | |
require 'future_learn/cops/forbid_shoulda_matchers' | |
RSpec.describe RuboCop::Cop::FutureLearn::ForbidShouldaMatchers do | |
include CopHelper | |
include RuboCop::RSpec::ExpectOffense | |
let(:config) { RuboCop::Config.new } | |
subject(:cop) { described_class.new(config) } | |
it 'hisses at the belong_to matcher' do | |
expect_offense(<<~RUBY) | |
it { is_expected.to belong_to(:no_man) } | |
^^^^^^^^^^^^^^^^^^ #{described_class::MSG} | |
RUBY | |
end | |
it 'hisses at the have_many matcher' do | |
expect_offense(<<~RUBY) | |
it { is_expected.to have_many(:ghastly_tongue_teeth) } | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #{described_class::MSG} | |
RUBY | |
end | |
it 'hisses at the have_one matcher' do | |
expect_offense(<<~RUBY) | |
it { is_expected.to have_one(:unquenchable_desire_for_havoc) } | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #{described_class::MSG} | |
RUBY | |
end | |
it 'hisses at the validate_presence_of matcher' do | |
expect_offense(<<~RUBY) | |
it { is_expected.to validate_presence_of(:anti_goose_protective_gear) } | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ #{described_class::MSG} | |
RUBY | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment