rubocop-rspec 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rubocop/cop/rspec/example_wording.rb +1 -1
- data/lib/rubocop/rspec/version.rb +1 -1
- data/spec/rubocop/cop/rspec/describe_class_spec.rb +2 -2
- data/spec/rubocop/cop/rspec/describe_method_spec.rb +1 -1
- data/spec/rubocop/cop/rspec/described_class_spec.rb +1 -1
- data/spec/rubocop/cop/rspec/example_wording_spec.rb +9 -0
- data/spec/rubocop/cop/rspec/file_path_spec.rb +18 -18
- data/spec/spec_helper.rb +16 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33cc3eb121d9cb56164a721c6856c1b640f7bed6
|
4
|
+
data.tar.gz: 668538c6096e0beee8e9acbffc0b7639c3a50c22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80ae0ce41af162ecbf52082e626a9921daf66b1f2e2b3b907105a6d247b611c548ba60228055e777a6fc06ac22e0702ce57b5a2afdc1c5eaac10ef7d8979cb8e
|
7
|
+
data.tar.gz: c10dc7627d94f250ffb294a62db891c8a9854208cfe4f40856653759858f0c6079bc38e3e6b3b573b904eefaf0d17f48fbacd9e1d3dc87f30e2bcea5e571da51
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,7 @@ describe RuboCop::Cop::RSpec::DescribeClass do
|
|
4
4
|
subject(:cop) { described_class.new }
|
5
5
|
|
6
6
|
it 'checks first-line describe statements' do
|
7
|
-
inspect_source(cop,
|
7
|
+
inspect_source(cop, 'describe "bad describe" do; end')
|
8
8
|
expect(cop.offenses.size).to eq(1)
|
9
9
|
expect(cop.offenses.map(&:line).sort).to eq([1])
|
10
10
|
expect(cop.messages).to eq(['The first argument to describe should be ' \
|
@@ -28,7 +28,7 @@ describe RuboCop::Cop::RSpec::DescribeClass do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "doesn't blow up on single-line describes" do
|
31
|
-
inspect_source(cop,
|
31
|
+
inspect_source(cop, 'describe Some::Class')
|
32
32
|
expect(cop.offenses).to be_empty
|
33
33
|
end
|
34
34
|
end
|
@@ -4,7 +4,7 @@ describe RuboCop::Cop::RSpec::DescribeMethod do
|
|
4
4
|
subject(:cop) { described_class.new }
|
5
5
|
|
6
6
|
it 'enforces non-method names' do
|
7
|
-
inspect_source(cop,
|
7
|
+
inspect_source(cop, "describe Some::Class, 'nope' do; end")
|
8
8
|
expect(cop.offenses.size).to eq(1)
|
9
9
|
expect(cop.offenses.map(&:line).sort).to eq([1])
|
10
10
|
expect(cop.messages)
|
@@ -18,6 +18,15 @@ describe RuboCop::Cop::RSpec::ExampleWording, :config do
|
|
18
18
|
expect(cop.highlights).to eq(['should do something'])
|
19
19
|
end
|
20
20
|
|
21
|
+
it 'finds description with `Should` at the beginning' do
|
22
|
+
inspect_source(cop, ["it 'Should do something' do", 'end'])
|
23
|
+
expect(cop.offenses.size).to eq(1)
|
24
|
+
expect(cop.offenses.map(&:line).sort).to eq([1])
|
25
|
+
expect(cop.messages)
|
26
|
+
.to eq(['Do not use should when describing your tests.'])
|
27
|
+
expect(cop.highlights).to eq(['Should do something'])
|
28
|
+
end
|
29
|
+
|
21
30
|
it 'finds description with `shouldn\'t` at the beginning' do
|
22
31
|
inspect_source(cop, ['it "shouldn\'t do something" do', 'end'])
|
23
32
|
expect(cop.offenses.size).to eq(1)
|
@@ -6,7 +6,7 @@ describe RuboCop::Cop::RSpec::FilePath, :config do
|
|
6
6
|
|
7
7
|
it 'checks the path' do
|
8
8
|
inspect_source(cop,
|
9
|
-
|
9
|
+
"describe MyClass, 'foo' do; end",
|
10
10
|
'wrong_path_foo_spec.rb')
|
11
11
|
expect(cop.offenses.size).to eq(1)
|
12
12
|
expect(cop.offenses.map(&:line).sort).to eq([1])
|
@@ -16,7 +16,7 @@ describe RuboCop::Cop::RSpec::FilePath, :config do
|
|
16
16
|
|
17
17
|
it 'checks the path' do
|
18
18
|
inspect_source(cop,
|
19
|
-
|
19
|
+
"describe MyClass, '#foo' do; end",
|
20
20
|
'wrong_class_foo_spec.rb')
|
21
21
|
expect(cop.offenses.size).to eq(1)
|
22
22
|
expect(cop.offenses.map(&:line).sort).to eq([1])
|
@@ -26,7 +26,7 @@ describe RuboCop::Cop::RSpec::FilePath, :config do
|
|
26
26
|
|
27
27
|
it 'checks class spec paths' do
|
28
28
|
inspect_source(cop,
|
29
|
-
|
29
|
+
'describe MyClass do; end',
|
30
30
|
'wrong_class_spec.rb')
|
31
31
|
expect(cop.offenses.size).to eq(1)
|
32
32
|
expect(cop.offenses.map(&:line).sort).to eq([1])
|
@@ -36,7 +36,7 @@ describe RuboCop::Cop::RSpec::FilePath, :config do
|
|
36
36
|
|
37
37
|
it 'skips specs that do not describe a class / method' do
|
38
38
|
inspect_source(cop,
|
39
|
-
|
39
|
+
"describe 'Test something' do; end",
|
40
40
|
'some/class/spec.rb')
|
41
41
|
expect(cop.offenses).to be_empty
|
42
42
|
end
|
@@ -51,98 +51,98 @@ describe RuboCop::Cop::RSpec::FilePath, :config do
|
|
51
51
|
|
52
52
|
it 'checks class specs' do
|
53
53
|
inspect_source(cop,
|
54
|
-
|
54
|
+
'describe Some::Class do; end',
|
55
55
|
'some/class_spec.rb')
|
56
56
|
expect(cop.offenses).to be_empty
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'handles CamelCaps class names' do
|
60
60
|
inspect_source(cop,
|
61
|
-
|
61
|
+
'describe MyClass do; end',
|
62
62
|
'my_class_spec.rb')
|
63
63
|
expect(cop.offenses).to be_empty
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'handles ACRONYMClassNames' do
|
67
67
|
inspect_source(cop,
|
68
|
-
|
68
|
+
'describe ABCOne::Two do; end',
|
69
69
|
'abc_one/two_spec.rb')
|
70
70
|
expect(cop.offenses).to be_empty
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'handles ALLCAPS class names' do
|
74
74
|
inspect_source(cop,
|
75
|
-
|
75
|
+
'describe ALLCAPS do; end',
|
76
76
|
'allcaps_spec.rb')
|
77
77
|
expect(cop.offenses).to be_empty
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'checks instance methods' do
|
81
81
|
inspect_source(cop,
|
82
|
-
|
82
|
+
"describe Some::Class, '#inst' do; end",
|
83
83
|
'some/class/inst_spec.rb')
|
84
84
|
expect(cop.offenses).to be_empty
|
85
85
|
end
|
86
86
|
|
87
87
|
it 'checks class methods' do
|
88
88
|
inspect_source(cop,
|
89
|
-
|
89
|
+
"describe Some::Class, '.inst' do; end",
|
90
90
|
'some/class/inst_spec.rb')
|
91
91
|
expect(cop.offenses).to be_empty
|
92
92
|
end
|
93
93
|
|
94
94
|
it 'allows flat hierarchies for instance methods' do
|
95
95
|
inspect_source(cop,
|
96
|
-
|
96
|
+
"describe Some::Class, '#inst' do; end",
|
97
97
|
'some/class_inst_spec.rb')
|
98
98
|
expect(cop.offenses).to be_empty
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'allows flat hierarchies for class methods' do
|
102
102
|
inspect_source(cop,
|
103
|
-
|
103
|
+
"describe Some::Class, '.inst' do; end",
|
104
104
|
'some/class_inst_spec.rb')
|
105
105
|
expect(cop.offenses).to be_empty
|
106
106
|
end
|
107
107
|
|
108
108
|
it 'allows subdirs for instance methods' do
|
109
109
|
inspect_source(cop,
|
110
|
-
|
110
|
+
"describe Some::Class, '#inst' do; end",
|
111
111
|
'some/class/instance_methods/inst_spec.rb')
|
112
112
|
expect(cop.offenses).to be_empty
|
113
113
|
end
|
114
114
|
|
115
115
|
it 'allows subdirs for class methods' do
|
116
116
|
inspect_source(cop,
|
117
|
-
|
117
|
+
"describe Some::Class, '.inst' do; end",
|
118
118
|
'some/class/class_methods/inst_spec.rb')
|
119
119
|
expect(cop.offenses).to be_empty
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'ignores non-alphanumeric characters' do
|
123
123
|
inspect_source(cop,
|
124
|
-
|
124
|
+
"describe Some::Class, '#pred?' do; end",
|
125
125
|
'some/class/pred_spec.rb')
|
126
126
|
expect(cop.offenses).to be_empty
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'allows flexibility with predicates' do
|
130
130
|
inspect_source(cop,
|
131
|
-
|
131
|
+
"describe Some::Class, '#thing?' do; end",
|
132
132
|
'some/class/thing_predicate_spec.rb')
|
133
133
|
expect(cop.offenses).to be_empty
|
134
134
|
end
|
135
135
|
|
136
136
|
it 'allows flexibility with operators' do
|
137
137
|
inspect_source(cop,
|
138
|
-
|
138
|
+
"describe MyClass, '#<=>' do; end",
|
139
139
|
'my_class/spaceship_operator_spec.rb')
|
140
140
|
expect(cop.offenses).to be_empty
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'respects custom module name transformation' do
|
144
144
|
inspect_source(cop,
|
145
|
-
|
145
|
+
"describe FooFoo::Some::Class, '#bar' do; end",
|
146
146
|
'foofoo/some/class/bar_spec.rb')
|
147
147
|
expect(cop.offenses).to be_empty
|
148
148
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,21 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require 'rubocop'
|
4
|
+
|
5
|
+
rubocop_gem_path = Gem::Specification.find_by_name('rubocop').gem_dir
|
6
|
+
Dir["#{rubocop_gem_path}/spec/support/**/*.rb"].each { |f| require f }
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.order = :random
|
10
|
+
|
11
|
+
config.expect_with :rspec do |expectations|
|
12
|
+
expectations.syntax = :expect # Disable `should`
|
13
|
+
end
|
14
|
+
|
15
|
+
config.mock_with :rspec do |mocks|
|
16
|
+
mocks.syntax = :expect # Disable `should_receive` and `stub`
|
17
|
+
end
|
18
|
+
end
|
7
19
|
|
8
20
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
21
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian MacLeod
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|