rspec-block_is_expected 1.0.5 → 1.0.6

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: 61309d40f2a932928d07386ca56fe0a80091e24a9f60bb1767b8855d7d6a11cb
4
- data.tar.gz: 51796a1ce8d0fb98cbe00f04966e6519944d9ee9b9ef3b67b2dd2e984c5cc81a
3
+ metadata.gz: 29d909e2873766b37f4471c2aed8edf9078432b514f964ae8cab5e534e89a4e2
4
+ data.tar.gz: e83daabfe2ba4bf79bb085c816b02bf033e9367285d52a315db41a0b7ed9fc6c
5
5
  SHA512:
6
- metadata.gz: 42adf2f35405d09ce84cd8dd52f90b404086de51c6f9b009dc5640530684d3f4dcfbbc440289ad016321856a8792a6ec9e3b979a060bbdfc9840730c6d8c862b
7
- data.tar.gz: 8a0bfb4c4854c72b021f0034aa85a80116317532f65438a8707c488890d2fcabe80e8dcdce5e21db8351ee3f112a488cc5abfa8479b68f1bca9d14dcdaa42ed4
6
+ metadata.gz: e2ddbefcfec8932992996837096e1f64af24ff09a1777fa278d6f880ca3c553758d0f8b3edf841bb0dd4efa4a0855a9a36392a7a1a2c774dd4185f863705d192
7
+ data.tar.gz: 9adad062146654efa05b2cfb61706afead7a763b9c8b52a153b824cf5550f16b17116c000f97093c90691b89c1a2a0becc145edc96a2e335254084edbfe3bf04
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Changelog
2
- All notable changes to this project will be documented in this file.
2
+ All notable changes to this project since v1.0.3 will be documented in this file.
3
3
 
4
4
  The format is based on [Keep a Changelog v1](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.0.0.html).
@@ -10,7 +10,17 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
10
10
  ### Fixed
11
11
  ### Removed
12
12
 
13
- ## [1.0.5] - 2023-04-01
13
+ ## [1.0.6] 2024-06-23 ([tag][1.0.6t])
14
+ ### Added
15
+ - Security policy (SECURITY.md)
16
+ - Random ordering of test suite
17
+ - shared examples:
18
+ - `block_is_expected to not raise`
19
+ - `block_is_expected to raise error`
20
+ - Appraisals for testing on every Ruby supported by GHA (2.0 - 3.3)
21
+ - Signed release
22
+
23
+ ## [1.0.5] - 2023-04-01 ([tag][1.0.5t])
14
24
  ### Added
15
25
  - Structured gemfiles
16
26
  - Rubocop with standard, gradual, & more
@@ -23,7 +33,7 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
23
33
  ### Fixed
24
34
  - README Badges (CI status)
25
35
 
26
- ## [1.0.4] - 2023-03-23
36
+ ## [1.0.4] - 2023-03-23 ([tag][1.0.4t])
27
37
  ### Added
28
38
  - Required ruby version in gemspec >= 1.8.7
29
39
  - not bumping major version, because this was already the de-facto minimum
@@ -33,7 +43,27 @@ and this project adheres to [Semantic Versioning v2](https://semver.org/spec/v2.
33
43
  - documentation of rubocop config
34
44
  - Copyright years
35
45
 
36
- ## [1.0.3] - 2023-03-23
46
+ ## [1.0.3] - 2023-03-23 ([tag][1.0.3t])
37
47
  ### Added
38
48
  - negated matchers
39
49
  - rubocop config
50
+
51
+ ## [1.0.2] - 2018-10-03
52
+
53
+ ## [1.0.1] - 2018-10-01
54
+
55
+ ## 1.0.0 - 2018-10-01
56
+ ### Added
57
+ - Initial Release
58
+
59
+ [Unreleased]: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.6...HEAD
60
+ [1.0.6]: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.5...v1.0.6
61
+ [1.0.6t]: https://github.com/pboling/rspec-block_is_expected/tags/v1.0.6
62
+ [1.0.5]: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.4...v1.0.5
63
+ [1.0.5t]: https://github.com/pboling/rspec-block_is_expected/tags/v1.0.5
64
+ [1.0.4]: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.3...v1.0.4
65
+ [1.0.4t]: https://github.com/pboling/rspec-block_is_expected/tags/v1.0.4
66
+ [1.0.3]: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.2...v1.0.3
67
+ [1.0.3t]: https://github.com/pboling/rspec-block_is_expected/tags/v1.0.3
68
+ [1.0.2]: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.1...v1.0.2
69
+ [1.0.1]: https://github.com/pboling/rspec-block_is_expected/compare/v1.0.0...v1.0.1
data/CONTRIBUTING.md CHANGED
@@ -1,8 +1,8 @@
1
1
  ## Contributing
2
2
 
3
- Bug reports and pull requests are welcome on GitLab at [https://gitlab.com/pboling/rspec-block_is_expected][🚎src-main]
3
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/pboling/rspec-block_is_expected][🚎src-main]
4
4
  . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to
5
- the [code of conduct][conduct].
5
+ the [code of conduct][🤝conduct].
6
6
 
7
7
  To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request
8
8
  and post a message to the [gitter chat][🏘chat].
@@ -11,26 +11,41 @@ and post a message to the [gitter chat][🏘chat].
11
11
 
12
12
  To release a new version:
13
13
 
14
- 1. Run `bin/setup && bin/rake` as a tests, coverage, & linting sanity check.
15
- 2. update the version number in `version.rb`
16
- 3. run `bundle exec rake build:checksum`
17
- 4. move the built gem to project root
18
- 5. run `bin/checksum` to create the missing SHA256 checksum
19
- 6. move the built gem back to `pkg/`
20
- 7. commit the changes
21
- 8. run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org][rubygems].
14
+ 1. Run `bin/setup && bin/rake` as a tests, coverage, & linting sanity check
15
+ 2. Update the version number in `version.rb`
16
+ 3. Run `bin/setup && bin/rake` again as a secondary check, and to update `Gemfile.lock`
17
+ 4. Run `git commit -am "🔖 Prepare release v<VERSION>"` to commit the changes
18
+ 5. Run `git push` to trigger the final CI pipeline before release, & merge PRs
19
+ a. NOTE: Remember to [check the build][🧪build]!
20
+ 6. Run `git checkout main`
21
+ 7. Run `git pull origin main` to ensure you will release the latest trunk code.
22
+ 8. Set `SOURCE_DATE_EPOCH` so `rake build` and `rake release` use same timestamp, and generate same checksums
23
+ a. Run `export SOURCE_DATE_EPOCH=$EPOCHSECONDS && echo $SOURCE_DATE_EPOCH`
24
+ b. If the echo above has no output, then it didn't work.
25
+ c. Note that you'll need the `zsh/datetime` module, if running `zsh`.
26
+ 9. Run `bundle exec rake build`
27
+ 10. Run [`bin/checksums`][🔒️rubygems-checksums-pr] to create SHA-256 and SHA-512 checksums
28
+ a. Checksums will be committed automatically by the script, but not pushed
29
+ 11. Run `bundle exec rake release` which will create a git tag for the version,
30
+ push git commits and tags, and push the `.gem` file to [rubygems.org][💎rubygems]
22
31
 
23
32
  NOTE: You will need to have a public key in `certs/`, and list your cert in the
24
33
  `gemspec`, in order to sign the new release.
25
- See: [RubyGems Security Guide][rubygems-security-guide]
34
+ See: [RubyGems Security Guide][🔒️rubygems-security-guide]
26
35
 
27
36
  ## Contributors
28
37
 
29
- See: [https://gitlab.com/pboling/rspec-block_is_expected/-/graphs/main][🖐contributors]
38
+ [![Contributors][🖐contributors-img]][🖐contributors]
30
39
 
31
- [conduct]: https://gitlab.com/pboling/rspec-block_is_expected/-/blob/main/CODE_OF_CONDUCT.md
32
- [🖐contributors]: https://gitlab.com/pboling/rspec-block_is_expected/-/graphs/main
33
- [🚎src-main]: https://gitlab.com/pboling/rspec-block_is_expected/-/tree/main
40
+ Made with [contributors-img][🖐contrib-rocks].
41
+
42
+ [🧪build]: https://github.com/pboling/rspec-block_is_expected/actions
34
43
  [🏘chat]: https://matrix.to/#/%23pboling_rspec-block_is_expected:gitter.im
35
- [rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
36
- [rubygems]: https://rubygems.org
44
+ [🤝conduct]: https://github.com/pboling/rspec-block_is_expected/blob/main/CODE_OF_CONDUCT.md
45
+ [🖐contrib-rocks]: https://contrib.rocks
46
+ [🖐contributors]: https://github.com/pboling/rspec-block_is_expected/graphs/contributors
47
+ [🖐contributors-img]: https://contrib.rocks/image?repo=pboling/rspec-block_is_expected
48
+ [💎rubygems]: https://rubygems.org
49
+ [🔒️rubygems-security-guide]: https://guides.rubygems.org/security/#building-gems
50
+ [🔒️rubygems-checksums-pr]: https://github.com/rubygems/guides/pull/325
51
+ [🚎src-main]: https://github.com/pboling/rspec-block_is_expected
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright © 2018, 2020, 2023 Peter H. Boling of RailsBling.com
1
+ Copyright © 2018, 2020, 2023 - 2024 Peter H. Boling of RailsBling.com
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,29 +1,121 @@
1
1
  # Rspec::BlockIsExpected
2
2
 
3
- This gem does one very simple thing very well. It allows you to use `block_is_expected` similarly to how you would use `is_expected` if a block was wrapping the subject. Supports the same versions of Ruby that RSpec does, 1.8.7 - current ruby-head, as well as the JRuby equivalents.
3
+ <div id="badges">
4
4
 
5
+ [![CI Build][🚎dl-cwfi]][🚎dl-cwf]
6
+ [![Test Coverage][🔑cc-covi]][🔑cc-cov]
7
+ [![Maintainability][🔑cc-mnti]][🔑cc-mnt]
8
+ [![Depfu][🔑depfui]][🔑depfu]
9
+
10
+ [🚎dl-cwf]: https://github.com/pboling/rspec-block_is_expected/actions/workflows/current.yml
11
+ [🚎dl-cwfi]: https://github.com/pboling/rspec-block_is_expected/actions/workflows/current.yml/badge.svg
12
+
13
+ [comment]: <> ( 🔑 KEYED LINKS )
14
+
15
+ [🔑cc-mnt]: https://codeclimate.com/github/pboling/rspec-block_is_expected/maintainability
16
+ [🔑cc-mnti]: https://api.codeclimate.com/v1/badges/ca0a12604ecc19f5e76d/maintainability
17
+ [🔑cc-cov]: https://codeclimate.com/github/pboling/rspec-block_is_expected/test_coverage
18
+ [🔑cc-covi]: https://api.codeclimate.com/v1/badges/ca0a12604ecc19f5e76d/test_coverage
19
+ [🔑depfu]: https://depfu.com/github/pboling/rspec-block_is_expected?project_id=5865
20
+ [🔑depfui]: https://badges.depfu.com/badges/79867e590f063376f40b031a1447c215/count.svg
21
+
22
+ -----
23
+
24
+ [![Liberapay Patrons][⛳liberapay-img]][⛳liberapay]
25
+ [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor]
26
+
27
+ <span class="badge-buymeacoffee">
28
+ <a href="https://ko-fi.com/O5O86SNP4" target='_blank' title="Donate to my FLOSS or refugee efforts at ko-fi.com"><img src="https://img.shields.io/badge/buy%20me%20coffee-donate-yellow.svg" alt="Buy me coffee donation button" /></a>
29
+ </span>
30
+ <span class="badge-patreon">
31
+ <a href="https://patreon.com/galtzo" title="Donate to my FLOSS or refugee efforts using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a>
32
+ </span>
33
+
34
+ </div>
35
+
36
+ [⛳liberapay-img]: https://img.shields.io/liberapay/patrons/pboling.svg?logo=liberapay
37
+ [⛳liberapay]: https://liberapay.com/pboling/donate
38
+ [🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
39
+ [🖇sponsor]: https://github.com/sponsors/pboling
40
+
41
+ This gem does ~~five~~, _three sir_, five things.
42
+
43
+ 1. Provides `block_is_expected` to set expectations on the result of running the `subject` as a block.
44
+ 2. Provides, via shared example groups, shortcut RSpec macros for setting an expectation on errors being raised (or not).
45
+ ```ruby
46
+ it_behaves_like "block_is_expected to not raise"
47
+ it_behaves_like "block_is_expected to raise error", RuntimeError
48
+ ```
49
+ 3. Provides RSpec negated matchers that can be used with `block_is_expected`:
50
+ ```ruby
51
+ not_change
52
+ not_raise_error
53
+ ```
54
+ And two others that are so generally useful I end up defining them on every project:
55
+ ```ruby
56
+ not_include
57
+ not_eq
58
+ ```
59
+
60
+ ## Just show me the money
61
+
62
+ First, configure in your rspec helper, or similar:
5
63
  ```ruby
6
- subject { Integer(nil) }
7
- it("raises") { block_is_expected.to(raise_error(TypeError)) }
8
- ```
9
-
10
- | Project | RSpec::BlockIsExpected |
11
- |------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
12
- | gem name | [rspec-block_is_expected](https://rubygems.org/gems/rspec-block_is_expected) |
13
- | license | [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) |
14
- | download rank | [![Downloads Today](https://img.shields.io/gem/rd/rspec-block_is_expected.svg)](https://github.com/pboling/rspec-block_is_expected) |
15
- | version | [![Version](https://img.shields.io/gem/v/rspec-block_is_expected.svg)](https://rubygems.org/gems/rspec-block_is_expected) |
16
- | dependencies | [![Depfu][depfu-img]][depfu] |
17
- | continuous integration | [![Current][🚎cwfi]][🚎cwf] [![Heads][🖐hwfi]][🖐hwf] [![Style][🧮swfi]][🧮swf] |
18
- | test coverage | [![Test Coverage][cc-covi]][cc-cov] |
19
- | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/ca0a12604ecc19f5e76d/maintainability)](https://codeclimate.com/github/pboling/rspec-block_is_expected/maintainability) |
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
- | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
22
- | documentation | [on RDoc.info][documentation] |
23
- | Spread ~♡ⓛⓞⓥⓔ♡~ | [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay], [🧊][🧊berg], [🛖][🛖hut], [🧪][🧪lab], [🌏][aboutme], [👼][angellist], [⚗️][devto], [![Tweet @galtzo][followme]][twitter] |
24
-
25
- [🚎cwf]: https://github.com/pboling/rspec-block_is_expected/actions/workflows/current.yml
26
- [🚎cwfi]: https://github.com/pboling/rspec-block_is_expected/actions/workflows/current.yml/badge.svg
64
+ require "rspec/block_is_expected"
65
+ ```
66
+
67
+ Then,
68
+
69
+ 1. Custom expectation on result of subject as block
70
+ ```ruby
71
+ subject { Integer("1") }
72
+ it("raises") { block_is_expected.to(not_raise_error) }
73
+ ```
74
+ 2. Subject will not raise an exception
75
+ ```ruby
76
+ subject { Integer("1") }
77
+ it_behaves_like "block_is_expected to not raise"
78
+ ```
79
+ 3. Subject will raise an exception
80
+ ```ruby
81
+ subject { Integer(nil) }
82
+ it_behaves_like "block_is_expected to raise error", TypeError
83
+ ```
84
+
85
+ | Project | `bundle add rspec-block_is_expected --group test` |
86
+ |--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
87
+ | name, license, docs, standards | [![RubyGems.org][⛳️name-img]][⛳️gem] [![License: MIT][🖇src-license-img]][🖇src-license] [![RubyDoc.info][🚎yard-img]][🚎yard] [![SemVer 2.0.0][🧮semver-img]][🧮semver] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] |
88
+ | version & activity | [![Gem Version][⛳️version-img]][⛳️gem] [![Total Downloads][🖇DL-total-img]][⛳️gem] [![Download Rank][🏘DL-rank-img]][⛳️gem] |
89
+ | dependencies | [![Depfu][🔑depfui]][🔑depfu] |
90
+ | continuous integration | [![CI Build][🚎dl-cwfi]][🚎dl-cwf] [![Heads][🖐hwfi]][🖐hwf] [![Style][🧮swfi]][🧮swf] |
91
+ | test coverage | [![Test Coverage][🔑cc-covi]][🔑cc-cov] |
92
+ | maintainability | [![Maintainability](https://api.codeclimate.com/v1/badges/ca0a12604ecc19f5e76d/maintainability)](https://codeclimate.com/github/pboling/rspec-block_is_expected/maintainability) |
93
+ | 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) |
94
+ | homepage | [on Github.com][homepage], [on Railsbling.com][blogpage] |
95
+ | documentation | [on RDoc.info][documentation] |
96
+ | `...` 💖 | [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay], [🧊][🧊berg], [🛖][🛖hut], [🧪][🧪lab], [🌏][aboutme], [👼][angellist], [⚗️][devto], [![Tweet @galtzo][followme]][twitter] |
97
+
98
+ <!--
99
+ The link tokens in the following sections should be kept ordered by the row and badge numbering scheme
100
+ -->
101
+
102
+ <!-- 1️⃣ name, license, docs -->
103
+ [⛳️gem]: https://rubygems.org/gems/rspec-block_is_expected
104
+ [⛳️name-img]: https://img.shields.io/badge/name-rspec--block__is__expected-brightgreen.svg?style=flat
105
+ [🖇src-license]: https://opensource.org/licenses/MIT
106
+ [🖇src-license-img]: https://img.shields.io/badge/License-MIT-green.svg
107
+ [🚎yard]: https://www.rubydoc.info/gems/rspec-block_is_expected
108
+ [🚎yard-img]: https://img.shields.io/badge/documentation-rubydoc-brightgreen.svg?style=flat
109
+ [🧮semver]: http://semver.org/
110
+ [🧮semver-img]: https://img.shields.io/badge/semver-2.0.0-FFDD67.svg?style=flat
111
+ [📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
112
+ [📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-FFDD67.svg?style=flat
113
+
114
+ <!-- 2️⃣ version & activity -->
115
+ [⛳️version-img]: http://img.shields.io/gem/v/rspec-block_is_expected.svg
116
+ [🖇DL-total-img]: https://img.shields.io/gem/dt/rspec-block_is_expected.svg
117
+ [🏘DL-rank-img]: https://img.shields.io/gem/rt/rspec-block_is_expected.svg
118
+
27
119
  [🖐hwf]: https://github.com/pboling/rspec-block_is_expected/actions/workflows/heads.yml
28
120
  [🖐hwfi]: https://github.com/pboling/rspec-block_is_expected/actions/workflows/heads.yml/badge.svg
29
121
  [🧮swf]: https://github.com/pboling/rspec-block_is_expected/actions/workflows/style.yml
@@ -31,12 +123,16 @@ it("raises") { block_is_expected.to(raise_error(TypeError)) }
31
123
 
32
124
  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/).
33
125
 
126
+ ## Ruby Compatibility
127
+ Supports the same versions of Ruby that RSpec does, 1.8.7 - current ruby-head,
128
+ as well as the JRuby equivalents.
129
+
34
130
  ## Installation
35
131
 
36
132
  Add this line to your application's Gemfile:
37
133
 
38
134
  ```ruby
39
- gem "rspec-block_is_expected", :group => :test
135
+ gem "rspec-block_is_expected", :group => :test
40
136
  ```
41
137
 
42
138
  And then execute:
@@ -53,7 +149,7 @@ There is no configuration needed if you your test suite loads the bundle group (
53
149
 
54
150
  Otherwise, you may load it manually near the top of your `spec_helper.rb`, and it will self configure.
55
151
  ```ruby
56
- require "rspec/block_is_expected"
152
+ require "rspec/block_is_expected"
57
153
  ```
58
154
 
59
155
  ### RSpec Matchers
@@ -63,15 +159,15 @@ but `to_not` doesn't work with multiple expectations.
63
159
  So negated matchers are required. A basic set of them are included with this gem, and can be loaded with:
64
160
 
65
161
  ```ruby
66
- require "rspec/block_is_expected/matchers/not"
162
+ require "rspec/block_is_expected/matchers/not"
67
163
  ```
68
164
 
69
165
  This gives you the following matchers:
70
166
  ```ruby
71
- RSpec::Matchers.define_negated_matcher(:not_change, :change)
72
- RSpec::Matchers.define_negated_matcher(:not_include, :include)
73
- RSpec::Matchers.define_negated_matcher(:not_eq, :eq)
74
- RSpec::Matchers.define_negated_matcher(:not_raise_error, :raise_error)
167
+ RSpec::Matchers.define_negated_matcher(:not_change, :change)
168
+ RSpec::Matchers.define_negated_matcher(:not_include, :include)
169
+ RSpec::Matchers.define_negated_matcher(:not_eq, :eq)
170
+ RSpec::Matchers.define_negated_matcher(:not_raise_error, :raise_error)
75
171
  ```
76
172
 
77
173
  #### Example
@@ -79,28 +175,28 @@ RSpec::Matchers.define_negated_matcher(:not_raise_error, :raise_error)
79
175
  You have a module like this:
80
176
 
81
177
  ```ruby
82
- module MyTasks
83
- def my_rakelib
84
- Rake.add_rakelib("bananas")
85
- end
86
- module_function :my_rakelib
87
- end
178
+ module MyTasks
179
+ def my_rakelib
180
+ Rake.add_rakelib("bananas")
181
+ end
182
+ module_function :my_rakelib
183
+ end
88
184
  ```
89
185
 
90
186
  You have a spec like this:
91
187
 
92
188
  ```ruby
93
- require "rake"
94
-
95
- RSpec.describe(MyTasks) do
96
- describe "my_rakelib" do
97
- subject(:my_rakelib) { described_class.my_rakelib }
98
- it "updates rakelib" do
99
- block_is_expected.to(not_raise_error &
100
- change { Rake.application.options.rakelib }.from(["rakelib"]).to(%w[rakelib bananas]))
189
+ require "rake"
190
+
191
+ RSpec.describe(MyTasks) do
192
+ describe "my_rakelib" do
193
+ subject(:my_rakelib) { described_class.my_rakelib }
194
+ it "updates rakelib" do
195
+ block_is_expected.to(not_raise_error &
196
+ change { Rake.application.options.rakelib }.from(["rakelib"]).to(%w[rakelib bananas]))
197
+ end
198
+ end
101
199
  end
102
- end
103
- end
104
200
  ```
105
201
 
106
202
  ### Integration with RuboCop
@@ -122,39 +218,39 @@ inherit_gem:
122
218
  The spec suite for this gem has some examples of usage, lightly edited here.
123
219
 
124
220
  ```ruby
125
- RSpec.describe("TestyMcTest") do
126
- context "errors raised" do
127
- subject { Integer(nil) }
128
- it("can be tested") do
129
- # Where you used to have:
130
- # expect { subject }.to raise_error(TypeError)
131
- block_is_expected.to(raise_error(TypeError))
132
- end
133
- end
134
- context "execution" do
135
- let(:mutex) { Mutex.new }
136
- subject { mutex.lock }
137
- it("can change state") do
138
- expect(mutex.locked?).to(eq(false))
139
- # Where you used to have:
140
- # expect { subject }.to_not raise_error
141
- block_is_expected.to_not(raise_error)
142
- expect(mutex.locked?).to(eq(true))
143
- end
144
- end
145
- context "changed state" do
146
- let(:mutex) { Mutex.new }
147
- subject { mutex.lock }
148
- it("can be tested") do
149
- # Where you used to have:
150
- # expect { subject }.to change { mutex.locked? }.from(false).to(true)
151
- block_is_expected.to(change { mutex.locked? }.from(false).to(true))
221
+ RSpec.describe("TestyMcTest") do
222
+ context "errors raised" do
223
+ subject { Integer(nil) }
224
+ it("can be tested") do
225
+ # Where you used to have:
226
+ # expect { subject }.to raise_error(TypeError)
227
+ block_is_expected.to(raise_error(TypeError))
228
+ end
229
+ end
230
+ context "execution" do
231
+ let(:mutex) { Mutex.new }
232
+ subject { mutex.lock }
233
+ it("can change state") do
234
+ expect(mutex.locked?).to(eq(false))
235
+ # Where you used to have:
236
+ # expect { subject }.to_not raise_error
237
+ block_is_expected.to_not(raise_error)
238
+ expect(mutex.locked?).to(eq(true))
239
+ end
240
+ end
241
+ context "changed state" do
242
+ let(:mutex) { Mutex.new }
243
+ subject { mutex.lock }
244
+ it("can be tested") do
245
+ # Where you used to have:
246
+ # expect { subject }.to change { mutex.locked? }.from(false).to(true)
247
+ block_is_expected.to(change { mutex.locked? }.from(false).to(true))
248
+ end
249
+ end
152
250
  end
153
- end
154
- end
155
251
  ```
156
252
 
157
- ## Switcch to `main` branch
253
+ ## Switch to `main` branch
158
254
 
159
255
  We recently migrated from `master` to `main` as the default branch. If this affected your local checkout:
160
256
  ```shell
@@ -184,6 +280,25 @@ See [CONTRIBUTING.md][contributing].
184
280
  See [CONTRIBUTING.md][contributing].
185
281
  [contributing]: https://gitlab.com/pboling/rspec-stubbed_env/-/blob/main/CONTRIBUTING.md
186
282
 
283
+ ### Running Specs
284
+
285
+ The basic compatibility matrix:
286
+ ```sh
287
+ appraisal install
288
+ appraisal rake test
289
+ ```
290
+
291
+ Sometimes also:
292
+ ```sh
293
+ BUNDLE_GEMFILE=gemfiles/vanilla.gemfile appraisal update
294
+ ```
295
+
296
+ NOTE: This results in bad paths to the gemspec.
297
+ `gemspec path: "../../"` needs to be replaced with `gemspec :path => "../"` in each Appraisal gemfile.
298
+
299
+ Except, is unlikely to be possible to install all of the supported Rubies & Railsies in a single container...
300
+ See the various github action workflows for more inspiration on running certain oldies.
301
+
187
302
  ## Code of Conduct
188
303
 
189
304
  Everyone interacting in the AnonymousActiveRecord project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct][conduct].
@@ -202,27 +317,27 @@ dependency on this gem using the [Pessimistic Version Constraint][pvc] with two
202
317
 
203
318
  For example in a `Gemfile`:
204
319
 
205
- gem 'rspec-block_is_expected', '~> 1.0', group: [:development, :test]
320
+ ```ruby
321
+ gem "rspec-block_is_expected", "~> 1.0", :group => [:development, :test]
322
+ ```
206
323
 
207
324
  or in a `gemspec`
208
325
 
209
- spec.add_development_dependency 'rspec-block_is_expected', '~> 1.0'
326
+ ```ruby
327
+ spec.add_development_dependency("rspec-block_is_expected", "~> 1.0")
328
+ ```
210
329
 
211
330
  ## Legal
212
331
 
213
- * Copyright © 2018, 2020, 2023 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
332
+ * Copyright © 2018, 2020, 2023 - 2024 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
214
333
 
215
334
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
216
335
 
217
336
  [aboutme]: https://about.me/peter.boling
218
337
  [angellist]: https://angel.co/peter-boling
219
338
  [blogpage]: http://www.railsbling.com/tags/rspec-block_is_expected/
220
- [cc-cov]: https://codeclimate.com/github/pboling/rspec-block_is_expected/test_coverage
221
- [cc-covi]: https://api.codeclimate.com/v1/badges/ca0a12604ecc19f5e76d/test_coverage
222
339
  [conduct]: CODE_OF_CONDUCT.md
223
340
  [contributing]: CONTRIBUTING.md
224
- [depfu]: https://depfu.com/github/pboling/rspec-block_is_expected?project_id=5614
225
- [depfu-img]: https://badges.depfu.com/badges/272ce0df3bc6df5cbea9354e2c3b65af/count.svg
226
341
  [devto]: https://dev.to/galtzo
227
342
  [documentation]: http://rdoc.info/github/pboling/rspec-block_is_expected/frames
228
343
  [followme]: https://img.shields.io/twitter/follow/galtzo.svg?style=social&label=Follow
data/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ |----------|-----------|
7
+ | 1.latest | ✅ |
8
+
9
+ ## Reporting a Vulnerability
10
+
11
+ Peter Boling is the primary maintainer of this gem. Please find a way
12
+ to [contact him directly](https://railsbling.com/contact) to report the issue. Include as much relevant information as
13
+ possible.
@@ -1,8 +1,8 @@
1
1
  require "rspec/core"
2
- begin
3
- RSpec.configure do |c|
4
- c.include(Rspec::BlockIsExpected)
5
- end
6
- rescue NameError
7
- # Rspec really should be loaded by now...
2
+ require "rspec/block_is_expected/matchers/not"
3
+
4
+ RSpec.configure do |c|
5
+ c.include(Rspec::BlockIsExpected)
8
6
  end
7
+ require "rspec/block_is_expected/shared_examples/block_does_not_raise_examples"
8
+ require "rspec/block_is_expected/shared_examples/block_raises_error_examples"
@@ -0,0 +1,5 @@
1
+ RSpec.shared_examples_for("block_is_expected to not raise") do
2
+ it "does not raise error" do
3
+ block_is_expected.not_to(raise_error)
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.shared_examples_for("block_is_expected to raise error") do |*error_args|
2
+ it "raises error #{error_args.inspect}" do
3
+ block_is_expected.to(raise_error(*error_args))
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module BlockIsExpected
3
- VERSION = "1.0.5".freeze
3
+ VERSION = "1.0.6".freeze
4
4
  end
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-block_is_expected
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -12,32 +12,94 @@ cert_chain:
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEgDCCAuigAwIBAgIBATANBgkqhkiG9w0BAQsFADBDMRUwEwYDVQQDDAxwZXRl
14
14
  ci5ib2xpbmcxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0yMjA5MTgyMzEyMzBaFw0yMzA5MTgyMzEyMzBaMEMxFTATBgNVBAMM
15
+ A2NvbTAeFw0yMzA5MjAxNzMwMjhaFw0yNDA5MTkxNzMwMjhaMEMxFTATBgNVBAMM
16
16
  DHBldGVyLmJvbGluZzEVMBMGCgmSJ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9A==
29
+ ggGBAMl9ifcw5p+PdvB7dCPoNKoVdp/2LbC9ztETHuYL2gUMJB6UoS3o9c/piSuR
30
+ V3ZMQaijmNu6ms1bWAtJ66LjmYrVflJtf9yp31Kierr9LpisMSUx2qbMOHGa8d2Z
31
+ vCUWPF8E9Cg0mP3GAyZ6qql8jDh/anUKeksPXqJvNxNPDu2DVYsa/IWdl96whzS4
32
+ Bl7SwB1E7agps40UcshCSKaVDOU0M+XN6SrnJMElnBic+KSAkBkVFbzS0BE4ODZM
33
+ BgE6nYzQ05qhuvbE+oGdACTlemNtDDWCh0uw+7x0q2PocGIDU5zsPn/WNTkCXPmB
34
+ CHGvqDNWq4M7ncTKAaS2XExgyb7uPdq9fKiOW8nmH+zCiGzJXzBWwZlKf7L4Ht9E
35
+ a3f0e5C+zvee9Z5Ng9ciyfav9/fcXgYt5MjoBv27THr5XfBhgOCIHSYW2tqJmWKi
36
+ KuxrfYrN+9HvMdm+nZ6TypmKftHY3Gj+/uu+g8Icm/zrvTWAEE0mcJOkfrIoNPJb
37
+ pF8dMA==
38
38
  -----END CERTIFICATE-----
39
- date: 2023-04-01 00:00:00.000000000 Z
40
- dependencies: []
39
+ date: 2024-06-23 00:00:00.000000000 Z
40
+ dependencies:
41
+ - !ruby/object:Gem::Dependency
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '10.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '10.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-pending_for
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.1'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 0.1.16
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.1'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.1.16
41
103
  description: subject { Integer(nil) }; it('raises') { block_is_expected.to raise_error(TypeError)
42
104
  }
43
105
  email:
@@ -51,9 +113,12 @@ files:
51
113
  - CONTRIBUTING.md
52
114
  - LICENSE.txt
53
115
  - README.md
116
+ - SECURITY.md
54
117
  - lib/rspec/block_is_expected.rb
55
118
  - lib/rspec/block_is_expected/matchers/not.rb
56
119
  - lib/rspec/block_is_expected/rspec.rb
120
+ - lib/rspec/block_is_expected/shared_examples/block_does_not_raise_examples.rb
121
+ - lib/rspec/block_is_expected/shared_examples/block_raises_error_examples.rb
57
122
  - lib/rspec/block_is_expected/version.rb
58
123
  - rubocop.yml
59
124
  homepage: https://github.com/pboling/rspec-block_is_expected
@@ -61,10 +126,10 @@ licenses:
61
126
  - MIT
62
127
  metadata:
63
128
  homepage_uri: https://github.com/pboling/rspec-block_is_expected
64
- source_code_uri: https://github.com/pboling/rspec-block_is_expected/tree/v1.0.5
65
- changelog_uri: https://github.com/pboling/rspec-block_is_expected/blob/v1.0.5/CHANGELOG.md
129
+ source_code_uri: https://github.com/pboling/rspec-block_is_expected/tree/v1.0.6
130
+ changelog_uri: https://github.com/pboling/rspec-block_is_expected/blob/v1.0.6/CHANGELOG.md
66
131
  bug_tracker_uri: https://github.com/pboling/rspec-block_is_expected/issues
67
- documentation_uri: https://www.rubydoc.info/gems/rspec-block_is_expected/1.0.5
132
+ documentation_uri: https://www.rubydoc.info/gems/rspec-block_is_expected/1.0.6
68
133
  funding_uri: https://liberapay.com/pboling
69
134
  wiki_uri: https://github.com/pboling/rspec-block_is_expected/wiki
70
135
  rubygems_mfa_required: 'true'
@@ -83,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
148
  - !ruby/object:Gem::Version
84
149
  version: '0'
85
150
  requirements: []
86
- rubygems_version: 3.4.10
151
+ rubygems_version: 3.4.19
87
152
  signing_key:
88
153
  specification_version: 4
89
154
  summary: Simplify testing of blocks in RSpec via block_is_expected
metadata.gz.sig CHANGED
Binary file