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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 781c177bf195bc9ec0663b45b2312aa2a94f6da2
4
- data.tar.gz: 44414a1e7ea2f3ee8ac707b8d6e5659e5789588b
3
+ metadata.gz: 33cc3eb121d9cb56164a721c6856c1b640f7bed6
4
+ data.tar.gz: 668538c6096e0beee8e9acbffc0b7639c3a50c22
5
5
  SHA512:
6
- metadata.gz: f95537228be6ba9d25328bfcb375091ba5bcfc2bc58ba384c910e6f87fd367a5510dfec4f47cdf07a2e863794a614d657c22b7d744b94380db6e6a67e6f6f78c
7
- data.tar.gz: 157e06d0dc76c034b8a2704dad0747d15cb59654412206957fa4c4365686adf8764544de0b8ad1ca6f21c7bc54d6e21b30a0e04526ec51636663d6b2f1dbe176
6
+ metadata.gz: 80ae0ce41af162ecbf52082e626a9921daf66b1f2e2b3b907105a6d247b611c548ba60228055e777a6fc06ac22e0702ce57b5a2afdc1c5eaac10ef7d8979cb8e
7
+ data.tar.gz: c10dc7627d94f250ffb294a62db891c8a9854208cfe4f40856653759858f0c6079bc38e3e6b3b573b904eefaf0d17f48fbacd9e1d3dc87f30e2bcea5e571da51
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ # 1.2.2
4
+
5
+ * Make `RSpec::ExampleWording` case insensitive. ([@geniou][])
6
+
3
7
  ## 1.2.1
4
8
 
5
9
  * Add `RSpec::VerifiedDoubles` cop. ([@andyw8][])
@@ -28,7 +28,7 @@ module RuboCop
28
28
 
29
29
  arguments = *(args.first)
30
30
  message = arguments.first.to_s
31
- return unless message.start_with?('should')
31
+ return unless message.downcase.start_with?('should')
32
32
 
33
33
  arg1 = args.first.loc.expression
34
34
  message = Parser::Source::Range
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module RSpec
5
5
  # Version information for the RSpec RuboCop plugin.
6
6
  module Version
7
- STRING = '1.2.1'
7
+ STRING = '1.2.2'
8
8
  end
9
9
  end
10
10
  end
@@ -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, ['describe "bad describe" do; end'])
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, ['describe Some::Class'])
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, ["describe Some::Class, 'nope' do; end"])
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)
@@ -86,7 +86,7 @@ describe RuboCop::Cop::RSpec::DescribedClass do
86
86
  end
87
87
 
88
88
  it 'checks for the use of described class with module' do
89
- pending 'TODO'
89
+ skip
90
90
  inspect_source(cop, ['module MyNamespace',
91
91
  ' describe MyClass do',
92
92
  ' subject { MyNamespace::MyClass }',
@@ -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
- ["describe MyClass, 'foo' do; end"],
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
- ["describe MyClass, '#foo' do; end"],
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
- ['describe MyClass do; end'],
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
- ["describe 'Test something' do; end"],
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
- ['describe Some::Class do; end'],
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
- ['describe MyClass do; end'],
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
- ['describe ABCOne::Two do; end'],
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
- ['describe ALLCAPS do; end'],
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
- ["describe Some::Class, '#inst' do; end"],
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
- ["describe Some::Class, '.inst' do; end"],
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
- ["describe Some::Class, '#inst' do; end"],
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
- ["describe Some::Class, '.inst' do; end"],
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
- ["describe Some::Class, '#inst' do; end"],
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
- ["describe Some::Class, '.inst' do; end"],
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
- ["describe Some::Class, '#pred?' do; end"],
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
- ["describe Some::Class, '#thing?' do; end"],
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
- ["describe MyClass, '#<=>' do; end"],
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
- ["describe FooFoo::Some::Class, '#bar' do; end"],
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
@@ -1,9 +1,21 @@
1
1
  # encoding: utf-8
2
2
 
3
- # As much as possible, we try to reuse RuboCop's spec environment.
4
- require File.join(
5
- Gem::Specification.find_by_name('rubocop').gem_dir, 'spec', 'spec_helper.rb'
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.1
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: 2014-11-03 00:00:00.000000000 Z
12
+ date: 2015-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rubocop