rubocop-discourse 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/rubocop-discourse.gemspec +1 -1
- data/rubocop-rspec.yml +3 -3
- data/spec/lib/rubocop/cop/no_add_reference_active_record_migrations_spec.rb +5 -4
- data/spec/lib/rubocop/cop/no_mixing_multisite_and_standard_specs_spec.rb +2 -2
- data/spec/lib/rubocop/cop/no_mocking_jobs_enqueue_spec.rb +2 -2
- data/spec/lib/rubocop/cop/no_reset_column_information_migrations_spec.rb +4 -2
- data/spec/lib/rubocop/cop/only_top_level_multisite_specs_spec.rb +4 -4
- data/spec/lib/rubocop/cop/time_eq_matcher_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c437452f89089230f8ab04486bbe351745b094292c80f838671fdcd33d83bdab
|
4
|
+
data.tar.gz: d4438004c26aee64eff9e6a2f0d335767b412ab2563e5e9d3bdbc1833be1a678
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a19afd24871782b52660905e0f211287fa41779994c21160baeb5c5e3963ea63482d7ea980ac9398a86b0f40c37056fdf82f982afc851bd6632fc6458d803ed
|
7
|
+
data.tar.gz: 6b6ee9c891637c8c2355bc1cf451d96245960700ef3d8f859a0845ee3a258eae70cf7c85b19493a2d32f7277a69bd4adbc4a16527eaf4e4c1f96509f14fbb64d
|
data/rubocop-discourse.gemspec
CHANGED
data/rubocop-rspec.yml
CHANGED
@@ -73,7 +73,7 @@ RSpec/EmptyLineAfterHook:
|
|
73
73
|
Enabled: false # TODO
|
74
74
|
|
75
75
|
RSpec/EmptyLineAfterSubject:
|
76
|
-
Enabled:
|
76
|
+
Enabled: true
|
77
77
|
|
78
78
|
RSpec/ExampleLength:
|
79
79
|
Enabled: false # To be decided
|
@@ -130,7 +130,7 @@ RSpec/IteratedExpectation:
|
|
130
130
|
Enabled: false # To be decided
|
131
131
|
|
132
132
|
RSpec/LeadingSubject:
|
133
|
-
Enabled:
|
133
|
+
Enabled: true
|
134
134
|
|
135
135
|
RSpec/LeakyConstantDeclaration:
|
136
136
|
Enabled: false # To be decided
|
@@ -157,7 +157,7 @@ RSpec/MultipleSubjects:
|
|
157
157
|
Enabled: true
|
158
158
|
|
159
159
|
RSpec/NamedSubject:
|
160
|
-
Enabled:
|
160
|
+
Enabled: true
|
161
161
|
|
162
162
|
RSpec/NestedGroups:
|
163
163
|
Enabled: false # To be decided
|
@@ -5,20 +5,21 @@ require "spec_helper"
|
|
5
5
|
describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration,
|
6
6
|
:config do
|
7
7
|
subject(:cop) { described_class.new(config) }
|
8
|
+
|
8
9
|
let(:config) { RuboCop::Config.new }
|
9
10
|
|
10
11
|
it "raises an offense if add_reference is used, with or without arguments" do
|
11
12
|
inspect_source(<<~RUBY)
|
12
13
|
add_reference :posts, :users, foreign_key: true, null: false
|
13
14
|
RUBY
|
14
|
-
expect(cop.offenses.first.message).to
|
15
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
15
16
|
end
|
16
17
|
|
17
18
|
it "raises an offense if add_belongs_to is used, with or without arguments" do
|
18
19
|
inspect_source(<<~RUBY)
|
19
20
|
add_belongs_to :posts, :users, foreign_key: true, null: false
|
20
21
|
RUBY
|
21
|
-
expect(cop.offenses.first.message).to
|
22
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
22
23
|
end
|
23
24
|
|
24
25
|
it "raises an offense if t.references, or any variable.references is used, with or without arguments" do
|
@@ -31,7 +32,7 @@ describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration,
|
|
31
32
|
end
|
32
33
|
RUBY
|
33
34
|
expect(cop.offenses.count).to eq(2)
|
34
|
-
expect(cop.offenses.first.message).to
|
35
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
35
36
|
end
|
36
37
|
|
37
38
|
it "raises an offense if t.belongs_to, or any variable.belongs_to is used, with or without arguments" do
|
@@ -44,6 +45,6 @@ describe RuboCop::Cop::Discourse::NoAddReferenceOrAliasesActiveRecordMigration,
|
|
44
45
|
end
|
45
46
|
RUBY
|
46
47
|
expect(cop.offenses.count).to eq(2)
|
47
|
-
expect(cop.offenses.first.message).to
|
48
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
48
49
|
end
|
49
50
|
end
|
@@ -16,7 +16,7 @@ describe RuboCop::Cop::Discourse::NoMixingMultisiteAndStandardSpecs, :config do
|
|
16
16
|
end
|
17
17
|
RUBY
|
18
18
|
|
19
|
-
expect(cop.offenses.first.message).to
|
19
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "raises an offense if there are multiple multisite and standard top-level describes" do
|
@@ -31,7 +31,7 @@ describe RuboCop::Cop::Discourse::NoMixingMultisiteAndStandardSpecs, :config do
|
|
31
31
|
end
|
32
32
|
RUBY
|
33
33
|
|
34
|
-
expect(cop.offenses.first.message).to
|
34
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "does not raise an offense if there are only multisite describes" do
|
@@ -12,7 +12,7 @@ describe RuboCop::Cop::Discourse::NoMockingJobs, :config do
|
|
12
12
|
Jobs.expects(:enqueue)
|
13
13
|
RUBY
|
14
14
|
|
15
|
-
expect(cop.offenses.first.message).to
|
15
|
+
expect(cop.offenses.first.message).to end_with(described_class::MSG)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "raises an offense if Jobs is mocked with :enqueue_in" do
|
@@ -20,7 +20,7 @@ describe RuboCop::Cop::Discourse::NoMockingJobs, :config do
|
|
20
20
|
Jobs.expects(:enqueue_in)
|
21
21
|
RUBY
|
22
22
|
|
23
|
-
expect(cop.offenses.first.message).to
|
23
|
+
expect(cop.offenses.first.message).to end_with(described_class::MSG)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "does not raise an offense if Jobs is not mocked with :enqueue or :enqueue_in" do
|
@@ -8,6 +8,8 @@ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations,
|
|
8
8
|
|
9
9
|
let(:config) { RuboCop::Config.new }
|
10
10
|
|
11
|
+
before { config["Discourse/NoResetColumnInformationInMigrations"]["Enabled"] = true }
|
12
|
+
|
11
13
|
it "raises an offense if reset_column_information is used" do
|
12
14
|
inspect_source(<<~RUBY)
|
13
15
|
class SomeMigration < ActiveRecord::Migration[6.0]
|
@@ -17,7 +19,7 @@ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations,
|
|
17
19
|
end
|
18
20
|
RUBY
|
19
21
|
|
20
|
-
expect(cop.offenses.first.message).to
|
22
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
21
23
|
end
|
22
24
|
|
23
25
|
it "raise an offense if reset_column_information is used without AR model" do
|
@@ -29,6 +31,6 @@ describe RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations,
|
|
29
31
|
end
|
30
32
|
RUBY
|
31
33
|
|
32
|
-
expect(cop.offenses.first.message).to
|
34
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
33
35
|
end
|
34
36
|
end
|
@@ -15,7 +15,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
|
|
15
15
|
end
|
16
16
|
RUBY
|
17
17
|
|
18
|
-
expect(cop.offenses.first.message).to
|
18
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
19
19
|
end
|
20
20
|
|
21
21
|
it "raises an offense if multisite config option is used in a sub-describe (RSpec const version)" do
|
@@ -26,7 +26,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
|
|
26
26
|
end
|
27
27
|
RUBY
|
28
28
|
|
29
|
-
expect(cop.offenses.first.message).to
|
29
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "raises an offense if multisite config option is used in an example" do
|
@@ -40,7 +40,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
|
|
40
40
|
end
|
41
41
|
RUBY
|
42
42
|
|
43
|
-
expect(cop.offenses.first.message).to
|
43
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "raises an offense if multisite config option is used in a context" do
|
@@ -51,7 +51,7 @@ describe RuboCop::Cop::Discourse::OnlyTopLevelMultisiteSpecs, :config do
|
|
51
51
|
end
|
52
52
|
RUBY
|
53
53
|
|
54
|
-
expect(cop.offenses.first.message).to
|
54
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "does not raise an offense if multisite config option is used on top-level describe" do
|
@@ -12,7 +12,7 @@ describe RuboCop::Cop::Discourse::TimeEqMatcher, :config do
|
|
12
12
|
expect(user.created_at).to eq(Time.zone.now)
|
13
13
|
RUBY
|
14
14
|
|
15
|
-
expect(cop.offenses.first.message).to
|
15
|
+
expect(cop.offenses.first.message).to match(described_class::MSG)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "passes if a timestamp is compared using `eq_time`" do
|
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: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Discourse Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|