saharspec 0.0.8 → 0.0.9
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +16 -6
- data/config/rubocop-rspec.yml +13 -0
- data/lib/saharspec/its/block.rb +4 -3
- data/lib/saharspec/its/call.rb +2 -2
- data/lib/saharspec/version.rb +1 -1
- data/saharspec.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f36fea6becab89824a594297f3eb830f98277a412b304ba439f8c97cc2d84ff
|
4
|
+
data.tar.gz: c62d07b013183f8425a7775fb653f63958cb9a24c66ae5f84a34717df2c8e06d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 216ee5c533e3e54e05ea03cdb12da2d582d7fa5d5dda82ac5ea9cb83eba22acb2f5eccf3257f644f224f79baa1e4879b6191de4c64d4aafd6be1fc67d58d2372
|
7
|
+
data.tar.gz: 2495db0a5cb29fcde39b6057f2789c0bcb70d71c53254f677ab8e8308abed99a8c2cd3bd70f8051fba29fed3e253e8537704f028ad4edf431ceafb41c8253b8c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Saharspec history
|
2
2
|
|
3
|
+
## 0.0.9 -- 2022-05-17
|
4
|
+
|
5
|
+
* Properly lint RSpec specs using `its_block`/`its_call`/`its_map` with `rubocop-rspec` >= 2.0 ([@ka8725](https://github.com/ka8725))
|
6
|
+
* Fix `its_block` and `its_call` to support RSpec 3.11
|
7
|
+
|
3
8
|
## 0.0.8 -- 2020-10-10
|
4
9
|
|
5
10
|
* Better `dont` failure message (just use underlying matchers `failure_message_when_negated`)
|
data/README.md
CHANGED
@@ -73,18 +73,18 @@ context 'when incompatible' do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# option 2. subject is block
|
76
|
-
subject { -> {2 + x } }
|
77
|
-
|
78
|
-
context 'when incompatible' do
|
79
|
-
let(:x) { '3' }
|
80
|
-
it { is_expected.to raise_error } # DRY
|
81
|
-
end
|
76
|
+
subject { -> { 2 + x } }
|
82
77
|
|
83
78
|
context 'when numeric' do
|
84
79
|
let(:x) { 3 }
|
85
80
|
it { expect(subject.call).to eq 5 } # not DRY
|
86
81
|
end
|
87
82
|
|
83
|
+
context 'when incompatible' do
|
84
|
+
let(:x) { '3' }
|
85
|
+
it { is_expected.to raise_error } # DRY
|
86
|
+
end
|
87
|
+
|
88
88
|
# after
|
89
89
|
require 'saharspec/matchers/ret'
|
90
90
|
|
@@ -250,6 +250,16 @@ describe '#delete_at' do
|
|
250
250
|
end
|
251
251
|
```
|
252
252
|
|
253
|
+
### Linting with RuboCop RSpec
|
254
|
+
|
255
|
+
`rubocop-rspec` fails to properly detect RSpec constructs that Saharspec defines (`its_call`, `its_block`, `its_map`).
|
256
|
+
Make sure to use `rubocop-rspec` 2.0 or newer and add the following to your `.rubocop.yml`:
|
257
|
+
|
258
|
+
```yaml
|
259
|
+
inherit_gem:
|
260
|
+
saharspec: config/rubocop-rspec.yml
|
261
|
+
```
|
262
|
+
|
253
263
|
## State & future
|
254
264
|
|
255
265
|
I use all of the components of the library on daily basis. Probably, I will extend it with other
|
data/lib/saharspec/its/block.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Saharspec
|
4
4
|
module Its
|
5
5
|
module Block
|
6
|
-
# Creates nested example
|
6
|
+
# Creates nested example that redefines implicit `is_expected` to use subject as a block.
|
7
7
|
#
|
8
8
|
# @example
|
9
9
|
#
|
@@ -34,12 +34,13 @@ module Saharspec
|
|
34
34
|
def its_block(*options, &block)
|
35
35
|
# rubocop:disable Lint/NestedMethodDefinition
|
36
36
|
describe('as block') do
|
37
|
+
# FIXME: Not necessary? (Previously, wrapped the subject in lambda, now just repeats it)
|
37
38
|
let(:__call_subject) do
|
38
|
-
|
39
|
+
subject
|
39
40
|
end
|
40
41
|
|
41
42
|
def is_expected
|
42
|
-
expect
|
43
|
+
expect { __call_subject }
|
43
44
|
end
|
44
45
|
|
45
46
|
example(nil, *options, &block)
|
data/lib/saharspec/its/call.rb
CHANGED
@@ -31,11 +31,11 @@ module Saharspec
|
|
31
31
|
# rubocop:disable Lint/NestedMethodDefinition
|
32
32
|
describe("(#{args.map(&:inspect).join(', ')})") do
|
33
33
|
let(:__call_subject) do
|
34
|
-
|
34
|
+
subject.call(*args)
|
35
35
|
end
|
36
36
|
|
37
37
|
def is_expected
|
38
|
-
expect
|
38
|
+
expect { __call_subject }
|
39
39
|
end
|
40
40
|
|
41
41
|
example(nil, &block)
|
data/lib/saharspec/version.rb
CHANGED
data/saharspec.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
if RUBY_VERSION >= '2.4' # Newest Rubocop fails on 2.3
|
31
31
|
s.add_development_dependency 'rubocop', '~> 0.93'
|
32
32
|
end
|
33
|
-
s.add_development_dependency 'rspec', '
|
33
|
+
s.add_development_dependency 'rspec', '>= 3.7.0'
|
34
34
|
s.add_development_dependency 'rspec-its'
|
35
35
|
s.add_development_dependency 'simplecov', '~> 0.9'
|
36
36
|
s.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saharspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Shepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2_keywords
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 3.7.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.7.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- CHANGELOG.md
|
134
134
|
- LICENSE.txt
|
135
135
|
- README.md
|
136
|
+
- config/rubocop-rspec.yml
|
136
137
|
- lib/saharspec.rb
|
137
138
|
- lib/saharspec/its.rb
|
138
139
|
- lib/saharspec/its/block.rb
|
@@ -167,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
168
|
- !ruby/object:Gem::Version
|
168
169
|
version: '0'
|
169
170
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
+
rubygems_version: 3.1.6
|
171
172
|
signing_key:
|
172
173
|
specification_version: 4
|
173
174
|
summary: Several additions for DRYer RSpec code
|