rubocop-discourse 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 954b3ae3f59036a9880d2d055c37e97e5bbc0d454207638cc390efb41cfde649
|
4
|
+
data.tar.gz: 7b5607256ae2d3190a9d7d1ef7d95f73deb23964139a8a10c3fb628663912d96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4916ff3fcd7569705f59ced1716acbbeec52d763eff392e6eb148d5bc72d4fe6cff5644a0dfedc89353b4f856d77e609159d178b2b2d9643f904bed88d59cb4a
|
7
|
+
data.tar.gz: 8c1a20229b96ef6b69085147c95c5b799c6f7c9b0d38e8dc63c5cb5dc07931a332c231771f45fe656bd03c563fd3fa85f8f1c2bf79d9d64ad96415ce6ce764e3
|
data/config/default.yml
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Discourse
|
6
|
+
class NoMockingJobs < Cop
|
7
|
+
MSG = "Use the test helpers provided by Sidekiq instead of mocking `Jobs`."
|
8
|
+
|
9
|
+
def_node_matcher :mocking_jobs?, <<~MATCHER
|
10
|
+
(send (const nil? :Jobs) :expects ...)
|
11
|
+
MATCHER
|
12
|
+
|
13
|
+
def on_send(node)
|
14
|
+
return unless mocking_jobs?(node)
|
15
|
+
add_offense(node, message: MSG)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/rubocop-discourse.gemspec
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RuboCop::Cop::Discourse::NoMockingJobs, :config do
|
6
|
+
subject(:cop) { described_class.new(config) }
|
7
|
+
|
8
|
+
let(:config) do
|
9
|
+
RuboCop::Config.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it "raises an offense if Jobs is mocked" do
|
13
|
+
inspect_source(<<~RUBY)
|
14
|
+
Jobs.expects(:enqueue)
|
15
|
+
RUBY
|
16
|
+
|
17
|
+
expect(cop.offenses.first.message).to eq(described_class::MSG)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "does not raise an offense if Jobs is not mocked" do
|
21
|
+
inspect_source(<<~RUBY)
|
22
|
+
Jobs.enqueue(:some_job)
|
23
|
+
RUBY
|
24
|
+
|
25
|
+
expect(cop.offenses).to eq([])
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-discourse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/rubocop/cop/discourse/no_chdir.rb
|
87
87
|
- lib/rubocop/cop/discourse/no_direct_multisite_manipulation.rb
|
88
88
|
- lib/rubocop/cop/discourse/no_json_parse_response.rb
|
89
|
+
- lib/rubocop/cop/discourse/no_mocking_jobs.rb
|
89
90
|
- lib/rubocop/cop/discourse/no_nokogiri_html_fragment.rb
|
90
91
|
- lib/rubocop/cop/discourse/no_reset_column_information_in_migrations.rb
|
91
92
|
- lib/rubocop/cop/discourse/no_time_new_without_args.rb
|
@@ -98,6 +99,7 @@ files:
|
|
98
99
|
- rubocop-discourse.gemspec
|
99
100
|
- rubocop-rspec.yml
|
100
101
|
- spec/lib/rubocop/cop/no_add_reference_active_record_migrations_spec.rb
|
102
|
+
- spec/lib/rubocop/cop/no_mocking_jobs_spec.rb
|
101
103
|
- spec/lib/rubocop/cop/no_reset_column_information_migrations_spec.rb
|
102
104
|
- spec/spec_helper.rb
|
103
105
|
homepage:
|