Commit 24493c50 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Replace it_behaves_like with include_examples

Improve specs output readability by replacing
`it_behaves_like` with `include_examples`
in `BeSuccessMatcher`
parent 69dbc5a5
...@@ -13,7 +13,7 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do ...@@ -13,7 +13,7 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do
shared_examples 'cop' do |good:, bad:| shared_examples 'cop' do |good:, bad:|
context "using #{bad} call" do context "using #{bad} call" do
it "registers an offense for `#{bad}`" do it 'registers an offense' do
inspect_source(bad, source_file) inspect_source(bad, source_file)
expect(cop.offenses.size).to eq(1) expect(cop.offenses.size).to eq(1)
...@@ -21,7 +21,7 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do ...@@ -21,7 +21,7 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do
expect(cop.highlights).to eq([bad]) expect(cop.highlights).to eq([bad])
end end
it "registers an offense for `#{bad}` and autocorrects it to `#{good}`" do it "autocorrects it to `#{good}`" do
autocorrected = autocorrect_source(bad, source_file) autocorrected = autocorrect_source(bad, source_file)
expect(autocorrected).to eql(good) expect(autocorrected).to eql(good)
...@@ -37,27 +37,27 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do ...@@ -37,27 +37,27 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do
end end
end end
it_behaves_like 'cop', include_examples 'cop',
bad: 'expect(response).to be_success', bad: 'expect(response).to be_success',
good: 'expect(response).to be_successful' good: 'expect(response).to be_successful'
it_behaves_like 'cop', include_examples 'cop',
bad: 'expect(response).to_not be_success', bad: 'expect(response).to_not be_success',
good: 'expect(response).to_not be_successful' good: 'expect(response).to_not be_successful'
it_behaves_like 'cop', include_examples 'cop',
bad: 'expect(response).not_to be_success', bad: 'expect(response).not_to be_success',
good: 'expect(response).not_to be_successful' good: 'expect(response).not_to be_successful'
it_behaves_like 'cop', include_examples 'cop',
bad: 'is_expected.to be_success', bad: 'is_expected.to be_success',
good: 'is_expected.to be_successful' good: 'is_expected.to be_successful'
it_behaves_like 'cop', include_examples 'cop',
bad: 'is_expected.to_not be_success', bad: 'is_expected.to_not be_success',
good: 'is_expected.to_not be_successful' good: 'is_expected.to_not be_successful'
it_behaves_like 'cop', include_examples 'cop',
bad: 'is_expected.not_to be_success', bad: 'is_expected.not_to be_success',
good: 'is_expected.not_to be_successful' good: 'is_expected.not_to be_successful'
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment