diff options
author | Vitali Tatarintev <vtatarintev@gitlab.com> | 2019-08-22 12:57:33 +0300 |
---|---|---|
committer | Vitali Tatarintev <vtatarintev@gitlab.com> | 2019-08-28 09:43:47 +0300 |
commit | 3a71ab523ebe9e8d30aabbf12e659eb75036d0b5 (patch) | |
tree | ac3fa7050f31f2a255c773f814a441a1447e3ae8 /spec | |
parent | 4f2ac51644754f9a4d4df697ac8984180b0bfdca (diff) |
Autocorrect `be_success` to `be_successful`
Diffstat (limited to 'spec')
-rw-r--r-- | spec/rubocop/cop/rspec/be_success_matcher_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb index fcb5791ef57..0d86553af36 100644 --- a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb +++ b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb @@ -27,6 +27,14 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do end end + shared_examples 'an autocorrected be_success call' do |content, autocorrected_content| + it "registers an offense for `#{content}` and autocorrects it to `#{autocorrected_content}`" do + autocorrected = autocorrect_source(content, source_file) + + expect(autocorrected).to eql(autocorrected_content) + end + end + context 'in a controller spec file' do before do allow(cop).to receive(:in_controller_spec?).and_return(true) @@ -34,10 +42,12 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do context "using expect(response).to be_success call" do it_behaves_like 'an offensive be_success call', OFFENSE_CALL_EXPECT_TO_BE_SUCCESS + it_behaves_like 'an autocorrected be_success call', OFFENSE_CALL_EXPECT_TO_BE_SUCCESS, CALL_EXPECT_TO_BE_SUCCESSFUL end context "using is_expected.to be_success call" do it_behaves_like 'an offensive be_success call', OFFENSE_CALL_IS_EXPECTED_TO_BE_SUCCESS + it_behaves_like 'an autocorrected be_success call', OFFENSE_CALL_IS_EXPECTED_TO_BE_SUCCESS, CALL_IS_EXPECTED_TO_BE_SUCCESSFUL end context "using expect(response).to be_successful" do |