rspec-block_is_expected 1.0.2 → 1.0.3

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: 3cef7bf00bb24e2c3c60293d3b3229485f9fc1703735ffab461d33a915ef4cfb
4
- data.tar.gz: 8693ea1be1ed6b7e44d13e39efac3fc2ec5ce2bfba65d1def223fbec452e5c5c
3
+ metadata.gz: b87ba86b4537ce94c390608b97dfb980bbba417e4e7f15c282756622bb373f12
4
+ data.tar.gz: d25f02f0dc67bdf2dbaae4347a79d5ce0bdf5fc378fbd344d0d91b65b92e12bf
5
5
  SHA512:
6
- metadata.gz: e922be0317291a31990767fd9c681fd8fd8095086e1bbae2de3b386a4e94b6aaead26ac79240ee0d068d93d42c526d8f6ec39ed40c1c13c411c53027ee9f74bf
7
- data.tar.gz: e2bc845a0f4b2b816801518eae6255d0c55a21ad01613cc49b447187c0402be5ad2df74e3379e771e6e831ec698974907c5bf2a26686fd2d07c84a042e559691
6
+ metadata.gz: 0ba6de54fb4d3605f05232ec24eb355a402284aecb797bbe3b5dd9c7dceeea63222f96b1eaaddf435ecf7dc96925fe426203d77acb15229c07bf5f06ac1c21cd
7
+ data.tar.gz: e633b9a2b7184db400e58193b830b3f3b1d8f4c68f6bfc48d51762ceb03644ee4a45d412e5dfdaa428274643df50761a50d06822a6e2322d4acf5c933955c1d1
data/.rubocop.yml CHANGED
@@ -1,3 +1,16 @@
1
+ inherit_from:
2
+ - .rubocop_todo.yml
3
+ - lib/rspec/block_is_expected/rubocop.yml
4
+
5
+ require:
6
+ - rubocop-lts
7
+ - rubocop-md
8
+ - rubocop-rake
9
+ - rubocop-rspec
10
+
11
+ inherit_gem:
12
+ rubocop-lts: rubocop-lts.yml
13
+
1
14
  AllCops:
2
15
  DisplayCopNames: true # Display the name of the failing cops
3
16
  Exclude:
@@ -5,7 +18,7 @@ AllCops:
5
18
  - 'vendor/**/*'
6
19
 
7
20
  Metrics/BlockLength:
8
- ExcludedMethods:
21
+ AllowedMethods:
9
22
  - context
10
23
  - describe
11
24
  - it
@@ -15,7 +28,7 @@ Metrics/BlockLength:
15
28
  - namespace
16
29
  - draw
17
30
 
18
- Metrics/LineLength:
31
+ Layout/LineLength:
19
32
  Enabled: false
20
33
 
21
34
  Style/HashSyntax:
@@ -33,3 +46,6 @@ Style/SymbolArray:
33
46
  # Enable when drop support for Ruby < 2
34
47
  Style/ExpandPathArguments:
35
48
  Enabled: false
49
+
50
+ RSpec/FactoryBot/CreateList:
51
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,67 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2023-03-23 17:51:30 UTC using RuboCop version 1.48.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 4
10
+ # Configuration parameters: EnforcedStyle, AllowedGems, Include.
11
+ # SupportedStyles: Gemfile, gems.rb, gemspec
12
+ # Include: **/*.gemspec, **/Gemfile, **/gems.rb
13
+ Gemspec/DevelopmentDependencies:
14
+ Exclude:
15
+ - 'rspec-block_is_expected.gemspec'
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: Severity, Include.
19
+ # Include: **/*.gemspec
20
+ Gemspec/RequiredRubyVersion:
21
+ Exclude:
22
+ - 'rspec-block_is_expected.gemspec'
23
+
24
+ # Offense count: 11
25
+ # Configuration parameters: AllowComments, AllowEmptyLambdas.
26
+ Lint/EmptyBlock:
27
+ Exclude:
28
+ - 'Appraisals'
29
+
30
+ # Offense count: 3
31
+ # Configuration parameters: Prefixes.
32
+ # Prefixes: when, with, without
33
+ RSpec/ContextWording:
34
+ Exclude:
35
+ - 'spec/rspec/block_is_expected_spec.rb'
36
+
37
+ # Offense count: 1
38
+ RSpec/MultipleExpectations:
39
+ Max: 2
40
+
41
+ # Offense count: 1
42
+ # This cop supports safe autocorrection (--autocorrect).
43
+ Rake/Desc:
44
+ Exclude:
45
+ - 'Rakefile'
46
+
47
+ # Offense count: 1
48
+ # This cop supports unsafe autocorrection (--autocorrect-all).
49
+ # Configuration parameters: AllowModifiersOnSymbols.
50
+ # SupportedStyles: inline, group
51
+ Style/AccessModifierDeclarations:
52
+ EnforcedStyle: inline
53
+
54
+ # Offense count: 1
55
+ # Configuration parameters: AllowedConstants.
56
+ Style/Documentation:
57
+ Exclude:
58
+ - '**/*.md'
59
+ - '**/*.markdown'
60
+ - 'lib/rspec/block_is_expected.rb'
61
+
62
+ # Offense count: 24
63
+ # This cop supports unsafe autocorrection (--autocorrect-all).
64
+ # Configuration parameters: EnforcedStyle.
65
+ # SupportedStyles: always, always_true, never
66
+ Style/FrozenStringLiteralComment:
67
+ Enabled: false
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog v1](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+ ### Added
9
+ ### Changed
10
+ ### Fixed
11
+ ### Removed
12
+
13
+ ## [1.0.3] - 2023-03-23
14
+ ### Added
15
+ - negated matchers
16
+ - rubocop config
data/Gemfile CHANGED
@@ -4,16 +4,17 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  group :test do
6
6
  ruby_version = Gem::Version.new(RUBY_VERSION)
7
- if ruby_version >= Gem::Version.new('2.1')
8
- gem 'rubocop', '~> 0.59.0'
9
- gem 'rubocop-rspec', '~> 1.24.0'
7
+ if ruby_version >= Gem::Version.new('2.7')
8
+ gem 'rubocop-lts', '~> 18.0'
9
+ gem 'rubocop-md'
10
+ gem 'rubocop-rake'
11
+ gem 'rubocop-rspec', '~> 1.42'
10
12
  end
11
13
  if ruby_version >= Gem::Version.new('2.0')
12
14
  gem 'byebug', '~> 10', :platform => :mri, :require => false
13
15
  gem 'pry', '~> 0', :platform => :mri, :require => false
14
16
  gem 'pry-byebug', '~> 3', :platform => :mri, :require => false
15
17
  end
16
- gem 'rspec-pending_for', '~> 0.1', :require => false
17
18
  gem 'simplecov', '~> 0', :require => false
18
19
  end
19
20
 
data/README.md CHANGED
@@ -20,7 +20,7 @@ it('raises') { block_is_expected.to raise_error(TypeError) }
20
20
  | code triage | [![Open Source Helpers](https://www.codetriage.com/pboling/rspec-block_is_expected/badges/users.svg)](https://www.codetriage.com/pboling/rspec-block_is_expected) |
21
21
  | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
22
22
  | documentation | [on RDoc.info][documentation] |
23
- | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌍 🌎 🌏][peterboling], [🍚][refugees], [➕][gplus], [👼][angellist], [🐛][topcoder], [:shipit:][coderwall], [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)][twitter] |
23
+ | Spread ~♡ⓛⓞⓥⓔ♡~ | [🌏](https://about.me/peter.boling), [👼](https://angel.co/peter-boling), [:shipit:](http://coderwall.com/pboling), [![Tweet Peter](https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow)](http://twitter.com/galtzo)|
24
24
 
25
25
  If you only ever want to test subjects wrapped in blocks, and are comfortable with **losing** the standard `is_expected` behavior, see an alternative to this gem [here](https://github.com/christopheraue/ruby-rspec-is_expected_block/).
26
26
 
@@ -29,7 +29,7 @@ If you only ever want to test subjects wrapped in blocks, and are comfortable wi
29
29
  Add this line to your application's Gemfile:
30
30
 
31
31
  ```ruby
32
- gem 'rspec-block_is_expected', group: :test
32
+ gem 'rspec-block_is_expected', :group => :test
33
33
  ```
34
34
 
35
35
  And then execute:
@@ -49,6 +49,66 @@ Otherwise, you may load it manually near the top of your `spec_helper.rb`, and i
49
49
  require 'rspec/block_is_expected'
50
50
  ```
51
51
 
52
+ ### RSpec Matchers
53
+
54
+ `block_is_expected` can be used to chain expectations related to the block,
55
+ but `to_not` doesn't work with multiple expectations.
56
+ So negated matchers are required. A basic set of them are included with this gem, and can be loaded with:
57
+
58
+ ```ruby
59
+ require 'rspec/block_is_expected/matchers/not'
60
+ ```
61
+
62
+ This gives you the following matchers:
63
+ ```ruby
64
+ RSpec::Matchers.define_negated_matcher :not_change, :change
65
+ RSpec::Matchers.define_negated_matcher :not_include, :include
66
+ RSpec::Matchers.define_negated_matcher :not_eq, :eq
67
+ RSpec::Matchers.define_negated_matcher :not_raise_error, :raise_error
68
+ ```
69
+
70
+ #### Example
71
+
72
+ You have a module like this:
73
+
74
+ ```ruby
75
+ module MyTasks
76
+ module_function def my_rakelib
77
+ Rake.add_rakelib('bananas')
78
+ end
79
+ end
80
+ ```
81
+
82
+ You have a spec like this:
83
+
84
+ ```ruby
85
+ require 'rake'
86
+
87
+ RSpec.describe(MyTasks) do
88
+ describe 'my_rakelib' do
89
+ subject(:my_rakelib) { described_class.my_rakelib }
90
+ it 'updates rakelib' do
91
+ block_is_expected.to not_raise_error &
92
+ change { Rake.application.options.rakelib }.from(['rakelib']).to(%w[rakelib bananas])
93
+ end
94
+ end
95
+ end
96
+ ```
97
+
98
+ ### Integration with RuboCop
99
+
100
+ You'll likely get the following linting error from `rubocop-rspec` if you use `block_is_expected.to ...`:
101
+ ```
102
+ RSpec/NoExpectationExample: No expectation found in this example.
103
+ ```
104
+
105
+ To fix it properly you need to register `block_is_expected` as an "expectation". In your `.rubocop.yml`
106
+
107
+ ```yml
108
+ inherit_gem:
109
+ rspec-block_is_expected: rspec/block_is_expected/rubocop.yml
110
+ ```
111
+
52
112
  ## Usage
53
113
 
54
114
  The spec suite for this gem has some examples of usage, lightly edited here.
@@ -137,7 +197,7 @@ or in a `gemspec`
137
197
 
138
198
  ## Legal
139
199
 
140
- * MIT License - See [LICENSE][license] file in this project [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
200
+ * MIT License - See [LICENSE][license] file in this project [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
141
201
 
142
202
  * Copyright (c) 2018 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
143
203
 
@@ -0,0 +1,4 @@
1
+ RSpec::Matchers.define_negated_matcher :not_change, :change
2
+ RSpec::Matchers.define_negated_matcher :not_include, :include
3
+ RSpec::Matchers.define_negated_matcher :not_eq, :eq
4
+ RSpec::Matchers.define_negated_matcher :not_raise_error, :raise_error
@@ -0,0 +1,4 @@
1
+ RSpec:
2
+ Language:
3
+ Expectations:
4
+ - block_is_expected
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module BlockIsExpected
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.0.3'.freeze
4
4
  end
5
5
  end
@@ -14,6 +14,15 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/pboling/rspec-block_is_expected'
15
15
  spec.license = 'MIT'
16
16
 
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = "#{spec.homepage}/tree/v#{spec.version}"
19
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
20
+ spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
21
+ spec.metadata['documentation_uri'] = "https://www.rubydoc.info/gems/#{spec.name}/#{spec.version}"
22
+ spec.metadata['funding_uri'] = 'https://liberapay.com/pboling'
23
+ spec.metadata['wiki_uri'] = "#{spec.homepage}/wiki"
24
+ spec.metadata['rubygems_mfa_required'] = 'true'
25
+
17
26
  # Specify which files should be added to the gem when it is released.
18
27
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
28
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -23,8 +32,8 @@ Gem::Specification.new do |spec|
23
32
  spec.add_dependency 'rspec-core'
24
33
 
25
34
  spec.add_development_dependency 'appraisal'
26
- spec.add_development_dependency 'bundler', '~> 1.16'
27
- spec.add_development_dependency 'rake', ['>= 10.0', '<= 13']
35
+ spec.add_development_dependency 'bundler'
36
+ spec.add_development_dependency 'rake'
28
37
  spec.add_development_dependency 'rspec', '~> 3.8'
29
38
  spec.add_development_dependency 'rspec-pending_for', '~> 0.1'
30
39
  spec.add_development_dependency 'wwtd'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-block_is_expected
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-03 00:00:00.000000000 Z
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -42,36 +42,30 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.16'
47
+ version: '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
- version: '1.16'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
62
- - - "<="
63
- - !ruby/object:Gem::Version
64
- version: '13'
61
+ version: '0'
65
62
  type: :development
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
66
  - - ">="
70
67
  - !ruby/object:Gem::Version
71
- version: '10.0'
72
- - - "<="
73
- - !ruby/object:Gem::Version
74
- version: '13'
68
+ version: '0'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: rspec
77
71
  requirement: !ruby/object:Gem::Requirement
@@ -125,8 +119,11 @@ files:
125
119
  - ".gitignore"
126
120
  - ".rspec"
127
121
  - ".rubocop.yml"
122
+ - ".rubocop_todo.yml"
123
+ - ".tool-versions"
128
124
  - ".travis.yml"
129
125
  - Appraisals
126
+ - CHANGELOG.md
130
127
  - CODE_OF_CONDUCT.md
131
128
  - Gemfile
132
129
  - LICENSE
@@ -148,14 +145,24 @@ files:
148
145
  - gemfiles/ruby_2.5.1.gemfile
149
146
  - gemfiles/ruby_head.gemfile
150
147
  - lib/rspec/block_is_expected.rb
148
+ - lib/rspec/block_is_expected/matchers/not.rb
151
149
  - lib/rspec/block_is_expected/rspec.rb
150
+ - lib/rspec/block_is_expected/rubocop.yml
152
151
  - lib/rspec/block_is_expected/version.rb
153
152
  - rspec-block_is_expected.gemspec
154
153
  homepage: https://github.com/pboling/rspec-block_is_expected
155
154
  licenses:
156
155
  - MIT
157
- metadata: {}
158
- post_install_message:
156
+ metadata:
157
+ homepage_uri: https://github.com/pboling/rspec-block_is_expected
158
+ source_code_uri: https://github.com/pboling/rspec-block_is_expected/tree/v1.0.3
159
+ changelog_uri: https://github.com/pboling/rspec-block_is_expected/blob/v1.0.3/CHANGELOG.md
160
+ bug_tracker_uri: https://github.com/pboling/rspec-block_is_expected/issues
161
+ documentation_uri: https://www.rubydoc.info/gems/rspec-block_is_expected/1.0.3
162
+ funding_uri: https://liberapay.com/pboling
163
+ wiki_uri: https://github.com/pboling/rspec-block_is_expected/wiki
164
+ rubygems_mfa_required: 'true'
165
+ post_install_message:
159
166
  rdoc_options: []
160
167
  require_paths:
161
168
  - lib
@@ -170,9 +177,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
177
  - !ruby/object:Gem::Version
171
178
  version: '0'
172
179
  requirements: []
173
- rubyforge_project:
174
- rubygems_version: 2.7.6
175
- signing_key:
180
+ rubygems_version: 3.4.9
181
+ signing_key:
176
182
  specification_version: 4
177
183
  summary: Simplify testing of blocks in RSpec via block_is_expected
178
184
  test_files: []