rubocop-discourse 3.2.0 → 3.4.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 +10 -7
- 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: 35b608dad822a1609917cf7d64b1426414a7c3457a5f274bf8ca33c1b43e5435
|
4
|
+
data.tar.gz: 69d5c9287ecf7762bdf87009b2e28173b63d23d5035cb8c792b31e494bc5e3a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f451974509c7ea0bd3c3030a5ad953cfd572a4230380b513de1db56ce0a4d6079a747df71e852129e94b4a639ded91989bb8019de0be6f0656822fdf56e80d3
|
7
|
+
data.tar.gz: 6cb9f773b5f97a6902122830e9907723bc42f4a79dc1e9a26ef8644e85ea045bbcd89cfb307e5c6585aa548e3aa1cf2a495e96e97da39b5c938e8b2836446a70
|
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
|
@@ -96,7 +96,10 @@ RSpec/ExpectInHook:
|
|
96
96
|
RSpec/ExpectOutput:
|
97
97
|
Enabled: true
|
98
98
|
|
99
|
-
RSpec/
|
99
|
+
RSpec/SpecFilePathFormat:
|
100
|
+
Enabled: false # To be decided
|
101
|
+
|
102
|
+
RSpec/SpecFilePathSuffix:
|
100
103
|
Enabled: false # To be decided
|
101
104
|
|
102
105
|
RSpec/Focus:
|
@@ -130,7 +133,7 @@ RSpec/IteratedExpectation:
|
|
130
133
|
Enabled: false # To be decided
|
131
134
|
|
132
135
|
RSpec/LeadingSubject:
|
133
|
-
Enabled:
|
136
|
+
Enabled: true
|
134
137
|
|
135
138
|
RSpec/LeakyConstantDeclaration:
|
136
139
|
Enabled: false # To be decided
|
@@ -157,7 +160,7 @@ RSpec/MultipleSubjects:
|
|
157
160
|
Enabled: true
|
158
161
|
|
159
162
|
RSpec/NamedSubject:
|
160
|
-
Enabled:
|
163
|
+
Enabled: true
|
161
164
|
|
162
165
|
RSpec/NestedGroups:
|
163
166
|
Enabled: false # To be decided
|
@@ -219,13 +222,13 @@ Capybara/CurrentPathExpectation:
|
|
219
222
|
RSpec/Capybara/FeatureMethods:
|
220
223
|
Enabled: true
|
221
224
|
|
222
|
-
|
225
|
+
FactoryBot/AttributeDefinedStatically:
|
223
226
|
Enabled: true
|
224
227
|
|
225
|
-
|
228
|
+
FactoryBot/CreateList:
|
226
229
|
Enabled: true
|
227
230
|
|
228
|
-
|
231
|
+
FactoryBot/FactoryClassName:
|
229
232
|
Enabled: true
|
230
233
|
|
231
234
|
RSpec/Rails/HttpStatus:
|
@@ -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.4.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-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|