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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/rubocop/cop/rspec/expect_gitlab_tracking_spec.rb
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/rubocop/cop/rspec/expect_gitlab_tracking_spec.rb')
-rw-r--r--spec/rubocop/cop/rspec/expect_gitlab_tracking_spec.rb27
1 files changed, 6 insertions, 21 deletions
diff --git a/spec/rubocop/cop/rspec/expect_gitlab_tracking_spec.rb b/spec/rubocop/cop/rspec/expect_gitlab_tracking_spec.rb
index f7adc1373df..d1ce8d01e0b 100644
--- a/spec/rubocop/cop/rspec/expect_gitlab_tracking_spec.rb
+++ b/spec/rubocop/cop/rspec/expect_gitlab_tracking_spec.rb
@@ -2,13 +2,9 @@
require 'fast_spec_helper'
require 'rubocop'
-require 'rubocop/rspec/support'
-
require_relative '../../../../rubocop/cop/rspec/expect_gitlab_tracking'
RSpec.describe RuboCop::Cop::RSpec::ExpectGitlabTracking do
- include CopHelper
-
let(:source_file) { 'spec/foo_spec.rb' }
subject(:cop) { described_class.new }
@@ -36,29 +32,18 @@ RSpec.describe RuboCop::Cop::RSpec::ExpectGitlabTracking do
good_samples.each do |good|
context "good: #{good}" do
it 'does not register an offense' do
- inspect_source(good)
-
- expect(cop.offenses).to be_empty
+ expect_no_offenses(good)
end
end
end
bad_samples.each do |bad|
context "bad: #{bad}" do
- it 'registers an offense', :aggregate_failures do
- inspect_source(bad, source_file)
-
- expect(cop.offenses.size).to eq(1)
- expect(cop.offenses.map(&:line)).to eq([1])
- expect(cop.highlights).to eq([bad])
-
- msg = cop.offenses.first.message
-
- expect(msg).to match(
- /Do not expect directly on `Gitlab::Tracking#event`/
- )
- expect(msg).to match(/add the `snowplow` annotation/)
- expect(msg).to match(/use `expect_snowplow_event` instead/)
+ it 'registers an offense' do
+ expect_offense(<<~CODE, node: bad)
+ %{node}
+ ^{node} Do not expect directly on `Gitlab::Tracking#event`[...]
+ CODE
end
end
end