r_spec 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -43
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4d1385151395cd826a177727b3b30e49d3c6a6987a1917227818f9e86893342
|
4
|
+
data.tar.gz: 96382fb495444187b3c9b1d927a08fa23a2991b208e016cb308b53a32f89df3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3481f838c965908f205e134ae8884925f64b7d2943cbf3efbd1298b00089775b75be049e15b7bdc9014967190d1def4fa13dd276b31a0b447179dafb93d1749c
|
7
|
+
data.tar.gz: 5191b6e4e55a363835c3f0e4e6cc30426a6852e2aa73c7e8071b71662d9c43b226fe8cba81a09f5fda1442a99ae3da585cd7a85c7b858c4a5fd99a389c4ef28e
|
data/README.md
CHANGED
@@ -1,28 +1,25 @@
|
|
1
1
|
# RSpec clone
|
2
2
|
|
3
|
-
A minimalist
|
3
|
+
A minimalist __RSpec clone__ with all the essentials.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
## Status
|
5
|
+
## Important ⚠️
|
8
6
|
|
9
|
-
[
|
10
|
-
|
11
|
-
[
|
12
|
-
[![RuboCop](https://github.com/cyril/r_spec.rb/workflows/RuboCop/badge.svg?branch=main)](https://github.com/cyril/r_spec.rb/actions?query=workflow%3Arubocop+branch%3Amain)
|
13
|
-
[![License](https://img.shields.io/github/license/cyril/r_spec.rb?label=License&logo=github)](https://github.com/cyril/r_spec.rb/raw/main/LICENSE.md)
|
7
|
+
To avoid confusion with the original [RSpec project](https://rspec.info/),
|
8
|
+
the decision was made to rename "`r_spec`" into "`r_spec-clone`".
|
9
|
+
Please consider renaming to [get the latest version](https://github.com/cyril/r_spec-clone.rb/). Happy testing!
|
14
10
|
|
15
11
|
## Project goals
|
16
12
|
|
17
|
-
|
18
|
-
|
13
|
+
1. Keep a low level of code complexity and ensure thread safety.
|
14
|
+
2. The interface must translate into atomic and simple Ruby objects.
|
15
|
+
3. Avoid overloading the interface with additional alternative syntaxes.
|
16
|
+
4. Provide most of RSpec's DSL to express expected outcomes of a code example.
|
19
17
|
|
20
18
|
## Some differences
|
21
19
|
|
22
|
-
*
|
23
|
-
* Spec files can also be executed directly with the `ruby` executable.
|
20
|
+
* Spec files can be executed with `ruby` directly.
|
24
21
|
* There is no option to activate monkey-patching.
|
25
|
-
* It does not rely on hacks such as `at_exit` hook to trigger the tests.
|
22
|
+
* It does not rely on hacks such as [`at_exit` hook](https://blog.arkency.com/2013/06/are-we-abusing-at-exit/) to trigger the tests.
|
26
23
|
* Built-in matchers [do not trust _actual_](https://asciinema.org/a/29172?autoplay=1&speed=2) and do not send it messages.
|
27
24
|
* If no `subject` has been explicitly determined, none is defined.
|
28
25
|
* If no described class is set, `described_class` is undefined instead of `nil`.
|
@@ -33,18 +30,6 @@ A minimalist __[RSpec](https://github.com/rspec/rspec) clone__ with all the esse
|
|
33
30
|
* `subject`, `before`, `after` and `let` definitions must come before examples.
|
34
31
|
* Each [`context` runs its tests in _isolation_](https://asciinema.org/a/29070?autoplay=1&speed=2) to prevent side effects.
|
35
32
|
|
36
|
-
## Important ⚠️
|
37
|
-
|
38
|
-
To avoid confusion in the community, please note that:
|
39
|
-
|
40
|
-
- the gem of this project is **not [`rspec`](https://rubygems.org/gems/rspec)**,
|
41
|
-
it is **[`r_spec`](https://rubygems.org/gems/r_spec)**;
|
42
|
-
- this project is totally independent of [rspec.info](https://rspec.info/).
|
43
|
-
|
44
|
-
### Note
|
45
|
-
|
46
|
-
Following [RubyGems naming conventions](https://guides.rubygems.org/name-your-gem/#use-underscores-for-multiple-words), the module name for this project is `RSpec`.
|
47
|
-
|
48
33
|
## Installation
|
49
34
|
|
50
35
|
Add this line to your application's Gemfile:
|
@@ -69,7 +54,7 @@ gem install r_spec
|
|
69
54
|
|
70
55
|
__RSpec clone__ provides a structure for writing executable examples of how your code should behave.
|
71
56
|
|
72
|
-
Inspired by
|
57
|
+
Inspired by RSpec, it includes a domain specific language (DSL) that allows you to write examples in a way similar to plain english.
|
73
58
|
|
74
59
|
A basic spec looks something like this:
|
75
60
|
|
@@ -107,8 +92,6 @@ To establish certain contexts — think _empty array_ versus _array with element
|
|
107
92
|
Its behavior is slightly different from `describe` because each `context` runs its tests in isolation,
|
108
93
|
so side effects caused by testing do not propagate out of contexts.
|
109
94
|
|
110
|
-
`describe` and `context` take an optional description as argument and a block containing the individual specs or nested groupings.
|
111
|
-
|
112
95
|
### Expectations
|
113
96
|
|
114
97
|
Expectations define if the value being tested (_actual_) matches a certain value or specific criteria.
|
@@ -168,7 +151,7 @@ expect(actual).to be_an_instance_of(expected) # passes if expected.equal?(actual
|
|
168
151
|
|
169
152
|
By convention, specs live in the `spec/` directory of a project. Spec files should end with `_spec.rb` to be recognizable as such.
|
170
153
|
|
171
|
-
Depending of the project settings, you may run the specs of a project by running `rake spec` (see
|
154
|
+
Depending of the project settings, you may run the specs of a project by running `rake spec` (see _Rake integration example_ section below).
|
172
155
|
A single file can also be executed directly with the Ruby interpreter.
|
173
156
|
|
174
157
|
#### Examples
|
@@ -185,7 +168,7 @@ Run a single file:
|
|
185
168
|
ruby spec/my/test/file_spec.rb
|
186
169
|
```
|
187
170
|
|
188
|
-
|
171
|
+
It is not recommended, but the RSpec's [`rspec` command line](https://relishapp.com/rspec/rspec-core/docs/command-line) might also work:
|
189
172
|
|
190
173
|
```sh
|
191
174
|
rspec spec/my/test/file_spec.rb
|
@@ -200,7 +183,7 @@ Many projects use a custom spec helper file, usually named `spec/spec_helper.rb`
|
|
200
183
|
|
201
184
|
This file is used to require `r_spec` and other includes, like the code from the project needed for every spec file.
|
202
185
|
|
203
|
-
###
|
186
|
+
### Rake integration example
|
204
187
|
|
205
188
|
The following `Rakefile` settings should be enough:
|
206
189
|
|
@@ -210,31 +193,35 @@ require "rake/testtask"
|
|
210
193
|
|
211
194
|
Rake::TestTask.new do |t|
|
212
195
|
t.pattern = "spec/**/*_spec.rb"
|
213
|
-
t.verbose = true
|
214
|
-
t.warning = true
|
215
196
|
end
|
216
197
|
|
217
198
|
task spec: :test
|
218
199
|
task default: :test
|
219
200
|
```
|
220
201
|
|
202
|
+
And then execute:
|
203
|
+
|
204
|
+
```sh
|
205
|
+
bundle exec rake
|
206
|
+
```
|
207
|
+
|
221
208
|
## Performance
|
222
209
|
|
223
210
|
### Runtime
|
224
211
|
|
225
|
-
Benchmark against [100 executions of a file containing one expectation](https://github.com/cyril/r_spec.rb/blob/main/benchmark/) (lower is better).
|
212
|
+
Benchmark against [100 executions of a file containing one expectation](https://github.com/cyril/r_spec-clone.rb/blob/main/benchmark/) (lower is better).
|
226
213
|
|
227
|
-
![Runtime](https://r-spec.dev/benchmark-runtime.png)
|
214
|
+
![Runtime](https://clone.r-spec.dev/benchmark-runtime.png)
|
228
215
|
|
229
216
|
## Test suite
|
230
217
|
|
231
|
-
__RSpec clone__'s specifications are self-described here: [spec/](https://github.com/cyril/r_spec.rb/blob/main/spec/)
|
218
|
+
__RSpec clone__'s specifications are self-described here: [spec/](https://github.com/cyril/r_spec-clone.rb/blob/main/spec/)
|
232
219
|
|
233
220
|
## Contact
|
234
221
|
|
235
222
|
* Home page: [https://r-spec.dev/](https://r-spec.dev/)
|
236
|
-
* Cheatsheet: [https://r-spec.dev/cheatsheet.html](https://r-spec.dev/cheatsheet.html)
|
237
|
-
* Source code: [https://github.com/cyril/r_spec.rb](https://github.com/cyril/r_spec.rb)
|
223
|
+
* Cheatsheet: [https://clone.r-spec.dev/cheatsheet.html](https://clone.r-spec.dev/cheatsheet.html)
|
224
|
+
* Source code: [https://github.com/cyril/r_spec-clone.rb](https://github.com/cyril/r_spec-clone.rb)
|
238
225
|
* API Doc: [https://rubydoc.info/gems/r_spec](https://rubydoc.info/gems/r_spec)
|
239
226
|
* Twitter: [https://twitter.com/cyri\_](https://twitter.com/cyri\_)
|
240
227
|
|
@@ -247,9 +234,9 @@ Without RSpec, this clone would not have been possible.
|
|
247
234
|
|
248
235
|
## Buy me a coffee ☕
|
249
236
|
|
250
|
-
If you like this project please consider making a small donation.
|
237
|
+
If you like this project, please consider making a small donation to Batman.
|
251
238
|
|
252
|
-
[![Donate
|
239
|
+
[![Donate](https://img.shields.io/badge/Donate-batman.eth-purple.svg)](https://etherscan.io/address/batman.eth)
|
253
240
|
|
254
241
|
## Versioning
|
255
242
|
|
@@ -257,7 +244,7 @@ __RSpec clone__ follows [Semantic Versioning 2.0](https://semver.org/).
|
|
257
244
|
|
258
245
|
## License
|
259
246
|
|
260
|
-
The [gem](https://rubygems.org/gems/r_spec) is available as open source under the terms of the [MIT License](https://github.com/cyril/r_spec.rb/raw/main/LICENSE.md).
|
247
|
+
The [gem](https://rubygems.org/gems/r_spec) is available as open source under the terms of the [MIT License](https://github.com/cyril/r_spec-clone.rb/raw/main/LICENSE.md).
|
261
248
|
|
262
249
|
## One more thing
|
263
250
|
|
@@ -265,4 +252,4 @@ Under the hood, __RSpec clone__ is largely animated by [a collection of testing
|
|
265
252
|
|
266
253
|
It's a living example of what we can do combining small libraries together that can boost the fun of programming.
|
267
254
|
|
268
|
-
![Fix testing tools logo for Ruby](https://github.com/cyril/r_spec.rb/raw/main/img/fixrb.svg)
|
255
|
+
![Fix testing tools logo for Ruby](https://github.com/cyril/r_spec-clone.rb/raw/main/img/fixrb.svg)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aw
|
@@ -220,11 +220,14 @@ homepage: https://r-spec.dev/
|
|
220
220
|
licenses:
|
221
221
|
- MIT
|
222
222
|
metadata:
|
223
|
-
bug_tracker_uri: https://github.com/cyril/r_spec.rb/issues
|
223
|
+
bug_tracker_uri: https://github.com/cyril/r_spec-clone.rb/issues
|
224
224
|
documentation_uri: https://rubydoc.info/gems/r_spec
|
225
|
-
source_code_uri: https://github.com/cyril/r_spec.rb
|
226
|
-
wiki_uri: https://github.com/cyril/r_spec.rb/wiki
|
227
|
-
post_install_message:
|
225
|
+
source_code_uri: https://github.com/cyril/r_spec-clone.rb
|
226
|
+
wiki_uri: https://github.com/cyril/r_spec-clone.rb/wiki
|
227
|
+
post_install_message: |
|
228
|
+
To avoid confusion with the original RSpec project,
|
229
|
+
the decision was made to rename "r_spec" into "r_spec-clone".
|
230
|
+
Please consider renaming to get the latest version. Happy testing!
|
228
231
|
rdoc_options: []
|
229
232
|
require_paths:
|
230
233
|
- lib
|