Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitali Tatarintev <vtatarintev@gitlab.com>2019-08-26 11:04:54 +0300
committerVitali Tatarintev <vtatarintev@gitlab.com>2019-08-28 09:43:47 +0300
commit99b27e69510e83006d4dd2e5ecc5c555409aa4a0 (patch)
tree80087416d0f94904e22f63bfbb39e6742b443b39 /spec/rubocop
parentb61d26f496a2041d7124fd3280031deda3cf5a43 (diff)
Utilize Rubocop's Include for BeSuccessMatcher
Use Rubocop's Include instead of manually checking the matcher in controllers specs.
Diffstat (limited to 'spec/rubocop')
-rw-r--r--spec/rubocop/cop/rspec/be_success_matcher_spec.rb34
1 files changed, 8 insertions, 26 deletions
diff --git a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb
index 95f08a61557..77aff7c9dcc 100644
--- a/spec/rubocop/cop/rspec/be_success_matcher_spec.rb
+++ b/spec/rubocop/cop/rspec/be_success_matcher_spec.rb
@@ -59,35 +59,17 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do
end
end
- context 'in a controller spec file' do
- before do
- allow(cop).to receive(:in_controller_spec?).and_return(true)
+ CODE_EXAMPLES.each do |code_example|
+ context "using #{code_example[:bad]} call" do
+ it_behaves_like 'an offensive be_success call', code_example[:bad]
+ it_behaves_like 'an autocorrected be_success call', code_example[:bad], code_example[:good]
end
- CODE_EXAMPLES.each do |code_example|
- context "using #{code_example[:bad]} call" do
- it_behaves_like 'an offensive be_success call', code_example[:bad]
- it_behaves_like 'an autocorrected be_success call', code_example[:bad], code_example[:good]
- end
-
- context "using #{code_example[:good]} call" do
- it 'does not register an offense' do
- inspect_source(code_example[:good])
-
- expect(cop.offenses.size).to eq(0)
- end
- end
- end
- end
-
- context 'outside of a controller spec file' do
- CODE_EXAMPLES.each do |code_example|
- context "using #{code_example[:bad]} call" do
- it 'does not register an offense' do
- inspect_source(code_example[:bad])
+ context "using #{code_example[:good]} call" do
+ it 'does not register an offense' do
+ inspect_source(code_example[:good])
- expect(cop.offenses.size).to eq(0)
- end
+ expect(cop.offenses.size).to eq(0)
end
end
end