saharspec 0.0.8 → 0.0.9

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
  SHA256:
3
- metadata.gz: 402e6f62d9abc17f1dad82a3a5f38ae8f844ca458ad87a4756192976e4cd5496
4
- data.tar.gz: 1541630eb677716d9ab2e58e1a25427ea86b67c5e001a52a25e9641491006971
3
+ metadata.gz: 8f36fea6becab89824a594297f3eb830f98277a412b304ba439f8c97cc2d84ff
4
+ data.tar.gz: c62d07b013183f8425a7775fb653f63958cb9a24c66ae5f84a34717df2c8e06d
5
5
  SHA512:
6
- metadata.gz: 7923af91fee36b0a8b8c79fdba8d0bf6503598ca62589d8d30a2e8dace0428f9338e892d5e3a0538c4fc857a209b390b6b88eebf8637c41dc68dd6c61d6772d5
7
- data.tar.gz: 5b844ac0a0098001638d19a2113e0eca4bf7acb225a87a456133e3d1ff564fc96648b95a0e0c37478c07d2532fc005e9c4db35a15b00f6b92018565c70097175
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
@@ -0,0 +1,13 @@
1
+ RSpec:
2
+ Language:
3
+ Includes:
4
+ Examples:
5
+ - its_block
6
+ - its_call
7
+ - its_map
8
+ - fits_block
9
+ - fits_call
10
+ - fits_map
11
+ - xits_block
12
+ - xits_call
13
+ - xits_map
@@ -3,7 +3,7 @@
3
3
  module Saharspec
4
4
  module Its
5
5
  module Block
6
- # Creates nested example which converts current subject to a block-subject.
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
- -> { subject }
39
+ subject
39
40
  end
40
41
 
41
42
  def is_expected
42
- expect(__call_subject)
43
+ expect { __call_subject }
43
44
  end
44
45
 
45
46
  example(nil, *options, &block)
@@ -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
- -> { subject.call(*args) }
34
+ subject.call(*args)
35
35
  end
36
36
 
37
37
  def is_expected
38
- expect(__call_subject)
38
+ expect { __call_subject }
39
39
  end
40
40
 
41
41
  example(nil, &block)
@@ -3,6 +3,6 @@
3
3
  module Saharspec
4
4
  MAJOR = 0
5
5
  MINOR = 0
6
- PATCH = 8
6
+ PATCH = 9
7
7
  VERSION = [MAJOR, MINOR, PATCH].join('.')
8
8
  end
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', '~> 3.7.0'
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.8
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: 2020-10-10 00:00:00.000000000 Z
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.0.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