r_spec 1.0.1 → 1.0.2
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/LICENSE.md +2 -2
- data/README.md +57 -199
- data/lib/r_spec.rb +3 -165
- metadata +13 -74
- data/lib/r_spec/console.rb +0 -38
- data/lib/r_spec/dsl.rb +0 -348
- data/lib/r_spec/error/pending_expectation.rb +0 -27
- data/lib/r_spec/error/reserved_method.rb +0 -11
- data/lib/r_spec/error/undefined_described_class.rb +0 -11
- data/lib/r_spec/error/undefined_subject.rb +0 -11
- data/lib/r_spec/error.rb +0 -14
- data/lib/r_spec/expectation_helper/it.rb +0 -41
- data/lib/r_spec/expectation_helper/its.rb +0 -25
- data/lib/r_spec/expectation_helper/shared.rb +0 -82
- data/lib/r_spec/expectation_helper.rb +0 -10
- data/lib/r_spec/expectation_target/base.rb +0 -82
- data/lib/r_spec/expectation_target/block.rb +0 -49
- data/lib/r_spec/expectation_target/value.rb +0 -48
- data/lib/r_spec/expectation_target.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07a1c8219cd7741811c7d89f5df7eba78b3bdc1ff33e08ca4d254c25d9787b7e
|
4
|
+
data.tar.gz: bc3e131d7934aa091b03d7bbd258afb69f1aaa53ef1cec1661a1f4580589209d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f167f145ade88ba9c45c3e744034c69145068a5fb42653cd52a6d068214c36da8160c447f993d07483bb76340a540e4917c26af29802178111c09fcc2e7e26
|
7
|
+
data.tar.gz: c3a8c57f1744d88d54640077e68be99a614b22d695830a3a1572b4a45ad900943879ccb5286de7cfd426d2b171d6916a102d30018a6e035edceb2032a184424f
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
The MIT License
|
1
|
+
# The MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2015-
|
3
|
+
Copyright (c) 2015-2022 Cyril Kato
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,34 +1,32 @@
|
|
1
|
-
# RSpec clone
|
1
|
+
# RSpec (clone)
|
2
2
|
|
3
|
-
A
|
3
|
+
> A small [RSpec](https://github.com/rspec) clone based on [Fix testing tools for Ruby](https://github.com/fixrb).
|
4
4
|
|
5
|
-
|
5
|
+
***
|
6
6
|
|
7
|
-
|
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!
|
7
|
+
:warning: Important:
|
10
8
|
|
11
|
-
|
9
|
+
I'd like to avoid confusion in the Ruby community by emphasizing that the gem of this project is not [rspec](https://rubygems.org/gems/rspec) but [r_spec](https://rubygems.org/gems/r_spec).
|
12
10
|
|
13
|
-
|
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.
|
11
|
+
The [r_spec](https://rubygems.org/gems/r_spec) gem is a minimalist and personal reimplementation of the popular RSpec framework. My reimplementation is therefore independent of the original RSpec project.
|
17
12
|
|
18
|
-
|
13
|
+
For the purpose of the DSL reimplementation, I have kept the same `RSpec` module name, and following the [Ruby gems naming convention](https://guides.rubygems.org/name-your-gem/#use-underscores-for-multiple-words), I called its gem [r_spec](https://rubygems.org/gems/r_spec).
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
15
|
+
However, to go further and explicitly indicate that this reimplementation is a clone, I have grouped all the code in a `RSpec::Clone` submodule within its [r_spec-clone](https://rubygems.org/gems/r_spec-clone) gem.
|
16
|
+
|
17
|
+
***
|
18
|
+
|
19
|
+
## Status
|
20
|
+
|
21
|
+
[](https://github.com/cyril/r_spec.rb/releases)
|
22
|
+
[](https://rubydoc.info/github/cyril/r_spec.rb/main)
|
23
|
+
[](https://github.com/cyril/r_spec.rb/actions?query=workflow%3Aci+branch%3Amain)
|
24
|
+
[](https://github.com/cyril/r_spec.rb/actions?query=workflow%3Arubocop+branch%3Amain)
|
25
|
+
[](https://github.com/cyril/r_spec.rb/raw/main/LICENSE.md)
|
26
|
+
|
27
|
+
## Why did I redid that?
|
28
|
+
|
29
|
+
An urge to simplify the RSpec DSL and reduce the complexity of the code that implements it, and nothing better to do during a stay in Tokyo.
|
32
30
|
|
33
31
|
## Installation
|
34
32
|
|
@@ -41,7 +39,7 @@ gem "r_spec"
|
|
41
39
|
And then execute:
|
42
40
|
|
43
41
|
```sh
|
44
|
-
bundle
|
42
|
+
bundle install
|
45
43
|
```
|
46
44
|
|
47
45
|
Or install it yourself as:
|
@@ -50,206 +48,66 @@ Or install it yourself as:
|
|
50
48
|
gem install r_spec
|
51
49
|
```
|
52
50
|
|
53
|
-
##
|
54
|
-
|
55
|
-
__RSpec clone__ provides a structure for writing executable examples of how your code should behave.
|
56
|
-
|
57
|
-
Inspired by RSpec, it includes a domain specific language (DSL) that allows you to write examples in a way similar to plain english.
|
58
|
-
|
59
|
-
A basic spec looks something like this:
|
60
|
-
|
61
|
-
[](https://asciinema.org/a/422210?autoplay=1&speed=2)
|
62
|
-
|
63
|
-
## Usage
|
64
|
-
|
65
|
-
### Anatomy of a spec file
|
51
|
+
## GitHub repo
|
66
52
|
|
67
|
-
|
68
|
-
Many projects use a custom spec helper which organizes these includes.
|
53
|
+
All the code is centralized in the `RSpec::Clone` module, whose source code is versioned at <https://github.com/cyril/r_spec-clone.rb>.
|
69
54
|
|
70
|
-
|
71
|
-
An optional descriptive string states it's purpose and a block contains the main logic performing the test.
|
55
|
+
## "`Hello, World!`" example
|
72
56
|
|
73
|
-
|
74
|
-
|
75
|
-
An `it` block contains an example that should invoke the code to be tested and define what is expected of it.
|
76
|
-
Each example can contain multiple expectations, but it should test only one specific behaviour.
|
77
|
-
|
78
|
-
To express an expectation, wrap an object or block in `expect`, call `to` (or `not_to`) and pass it a matcher object.
|
79
|
-
If the expectation is met, code execution continues.
|
80
|
-
Otherwise the example has _failed_ and other code will not be executed.
|
81
|
-
|
82
|
-
In test files, specs are structured by example groups which are defined by `describe` and `context` sections.
|
83
|
-
Typically a top level `describe` defines the outer unit (such as a class) to be tested by the spec.
|
84
|
-
Further `describe` sections can be nested within the outer unit to specify smaller units under test (such as individual methods).
|
85
|
-
|
86
|
-
For unit tests, it is recommended to follow the conventions for method names:
|
87
|
-
|
88
|
-
* outer `describe` is the name of the class, inner `describe` targets methods;
|
89
|
-
* instance methods are prefixed with `#`, class methods with `.`.
|
90
|
-
|
91
|
-
To establish certain contexts — think _empty array_ versus _array with elements_ — the `context` method may be used to communicate this to the reader.
|
92
|
-
Its behavior is slightly different from `describe` because each `context` runs its tests in isolation,
|
93
|
-
so side effects caused by testing do not propagate out of contexts.
|
94
|
-
|
95
|
-
### Expectations
|
96
|
-
|
97
|
-
Expectations define if the value being tested (_actual_) matches a certain value or specific criteria.
|
98
|
-
|
99
|
-
#### Equivalence
|
57
|
+
Let's imagine a `string_hello_world_spec.rb` file that contains this code:
|
100
58
|
|
101
59
|
```ruby
|
102
|
-
|
103
|
-
expect(actual).to eq(expected) # passes if expected.eql?(actual)
|
104
|
-
```
|
60
|
+
# frozen_string_literal: false
|
105
61
|
|
106
|
-
|
62
|
+
require "r_spec"
|
107
63
|
|
108
|
-
|
109
|
-
expect(actual).to equal(expected) # passes if expected.equal?(actual)
|
110
|
-
expect(actual).to be(expected) # passes if expected.equal?(actual)
|
111
|
-
```
|
112
|
-
|
113
|
-
#### Regular expressions
|
114
|
-
|
115
|
-
```ruby
|
116
|
-
expect(actual).to match(expected) # passes if expected.match?(actual)
|
117
|
-
```
|
118
|
-
|
119
|
-
#### Expecting errors
|
120
|
-
|
121
|
-
```ruby
|
122
|
-
expect { actual }.to raise_exception(expected) # passes if expected exception is raised
|
123
|
-
```
|
64
|
+
app = "Hello, World!"
|
124
65
|
|
125
|
-
|
66
|
+
RSpec.describe String do
|
67
|
+
subject do
|
68
|
+
app
|
69
|
+
end
|
126
70
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
#### Untruth
|
132
|
-
|
133
|
-
```ruby
|
134
|
-
expect(actual).to be_false # passes if false.equal?(actual)
|
135
|
-
```
|
71
|
+
before do
|
72
|
+
subject.gsub!("World", friend)
|
73
|
+
end
|
136
74
|
|
137
|
-
|
75
|
+
context "when Alice is greeted" do
|
76
|
+
let(:friend) { "Alice" }
|
138
77
|
|
139
|
-
|
140
|
-
|
141
|
-
```
|
78
|
+
it { is_expected.to eq "Hello, Alice!" }
|
79
|
+
end
|
142
80
|
|
143
|
-
|
81
|
+
context "when Bob is greeted" do
|
82
|
+
let(:friend) { "Bob" }
|
144
83
|
|
145
|
-
|
146
|
-
|
147
|
-
expect(actual).to be_an_instance_of(expected) # passes if expected.equal?(actual.class)
|
148
|
-
```
|
149
|
-
|
150
|
-
### Running specs
|
151
|
-
|
152
|
-
By convention, specs live in the `spec/` directory of a project. Spec files should end with `_spec.rb` to be recognizable as such.
|
153
|
-
|
154
|
-
Depending of the project settings, you may run the specs of a project by running `rake spec` (see _Rake integration example_ section below).
|
155
|
-
A single file can also be executed directly with the Ruby interpreter.
|
156
|
-
|
157
|
-
#### Examples
|
158
|
-
|
159
|
-
Run all specs in files matching `spec/**/*_spec.rb`:
|
160
|
-
|
161
|
-
```sh
|
162
|
-
bundle exec rake spec
|
163
|
-
```
|
164
|
-
|
165
|
-
Run a single file:
|
166
|
-
|
167
|
-
```sh
|
168
|
-
ruby spec/my/test/file_spec.rb
|
169
|
-
```
|
170
|
-
|
171
|
-
It is not recommended, but the RSpec's [`rspec` command line](https://relishapp.com/rspec/rspec-core/docs/command-line) might also work:
|
172
|
-
|
173
|
-
```sh
|
174
|
-
rspec spec/my/test/file_spec.rb
|
175
|
-
rspec spec/my/test/file_spec.rb:42
|
176
|
-
rspec spec/my/test/
|
177
|
-
rspec
|
178
|
-
```
|
179
|
-
|
180
|
-
### Spec helper
|
181
|
-
|
182
|
-
Many projects use a custom spec helper file, usually named `spec/spec_helper.rb`.
|
183
|
-
|
184
|
-
This file is used to require `r_spec` and other includes, like the code from the project needed for every spec file.
|
185
|
-
|
186
|
-
### Rake integration example
|
187
|
-
|
188
|
-
The following `Rakefile` settings should be enough:
|
189
|
-
|
190
|
-
```ruby
|
191
|
-
require "bundler/gem_tasks"
|
192
|
-
require "rake/testtask"
|
193
|
-
|
194
|
-
Rake::TestTask.new do |t|
|
195
|
-
t.pattern = "spec/**/*_spec.rb"
|
84
|
+
it { is_expected.to eq "Hello, Bob!" }
|
85
|
+
end
|
196
86
|
end
|
197
|
-
|
198
|
-
task spec: :test
|
199
|
-
task default: :test
|
200
87
|
```
|
201
88
|
|
202
|
-
|
89
|
+
We can run it with Ruby:
|
203
90
|
|
204
91
|
```sh
|
205
|
-
|
92
|
+
ruby string_hello_world_spec.rb
|
206
93
|
```
|
207
94
|
|
208
|
-
|
209
|
-
|
210
|
-
### Runtime
|
211
|
-
|
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).
|
213
|
-
|
214
|
-

|
215
|
-
|
216
|
-
## Test suite
|
95
|
+
The report of the execution should be:
|
217
96
|
|
218
|
-
|
97
|
+
> example/string_hello_world_spec.rb:19
|
98
|
+
> Success: expected to eq "Hello, Alice!".
|
99
|
+
> example/string_hello_world_spec.rb:25
|
100
|
+
> Success: expected to eq "Hello, Bob!".
|
219
101
|
|
220
|
-
##
|
102
|
+
## External links
|
221
103
|
|
222
|
-
*
|
223
|
-
*
|
224
|
-
* Source code: [https://github.com/cyril/r_spec-clone.rb](https://github.com/cyril/r_spec-clone.rb)
|
225
|
-
* API Doc: [https://rubydoc.info/gems/r_spec](https://rubydoc.info/gems/r_spec)
|
226
|
-
* Twitter: [https://twitter.com/cyri\_](https://twitter.com/cyri\_)
|
227
|
-
|
228
|
-
## Special thanks ❤️
|
229
|
-
|
230
|
-
I would like to thank the whole [RSpec team](https://rspec.info/about/) for all their work.
|
231
|
-
It's a great framework and it's a pleasure to work with every day.
|
232
|
-
|
233
|
-
Without RSpec, this clone would not have been possible.
|
234
|
-
|
235
|
-
## Buy me a coffee ☕
|
236
|
-
|
237
|
-
If you like this project, please consider making a small donation to Batman.
|
238
|
-
|
239
|
-
[](https://etherscan.io/address/batman.eth)
|
104
|
+
* [Official RSpec project](https://rspec.info/)
|
105
|
+
* [Personal RSpec reimplementation](https://r-spec.dev/)
|
240
106
|
|
241
107
|
## Versioning
|
242
108
|
|
243
|
-
|
109
|
+
__RSpec__ uses [Semantic Versioning 2.0.0](https://semver.org/)
|
244
110
|
|
245
111
|
## License
|
246
112
|
|
247
|
-
The [gem](https://rubygems.org/gems/r_spec) is available as open source under the terms of the [MIT License](https://
|
248
|
-
|
249
|
-
## One more thing
|
250
|
-
|
251
|
-
Under the hood, __RSpec clone__ is largely animated by [a collection of testing libraries designed to make programmers happy](https://github.com/fixrb/).
|
252
|
-
|
253
|
-
It's a living example of what we can do combining small libraries together that can boost the fun of programming.
|
254
|
-
|
255
|
-

|
113
|
+
The [gem](https://rubygems.org/gems/r_spec) is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/r_spec.rb
CHANGED
@@ -1,170 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative File.join("r_spec", "dsl")
|
4
|
-
|
5
3
|
# Top level namespace for the RSpec clone.
|
6
|
-
#
|
7
|
-
# @example The true from the false
|
8
|
-
# require "r_spec"
|
9
|
-
#
|
10
|
-
# RSpec.describe "The true from the false" do
|
11
|
-
# it { expect(false).not_to be true }
|
12
|
-
# end
|
13
|
-
#
|
14
|
-
# # Output to the console
|
15
|
-
# # Success: expected false not to be true.
|
16
|
-
#
|
17
|
-
# @example The basic behavior of arrays
|
18
|
-
# require "r_spec"
|
19
|
-
#
|
20
|
-
# RSpec.describe Array do
|
21
|
-
# describe "#size" do
|
22
|
-
# it "correctly reports the number of elements in the Array" do
|
23
|
-
# expect([1, 2, 3].size).to eq 3
|
24
|
-
# end
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# describe "#empty?" do
|
28
|
-
# it "is empty when no elements are in the array" do
|
29
|
-
# expect([].empty?).to be_true
|
30
|
-
# end
|
31
|
-
#
|
32
|
-
# it "is not empty if there are elements in the array" do
|
33
|
-
# expect([1].empty?).to be_false
|
34
|
-
# end
|
35
|
-
# end
|
36
|
-
# end
|
37
|
-
#
|
38
|
-
# # Output to the console
|
39
|
-
# # Success: expected to eq 3.
|
40
|
-
# # Success: expected true to be true.
|
41
|
-
# # Success: expected false to be false.
|
42
|
-
#
|
43
|
-
# @example An inherited definition of let
|
44
|
-
# require "r_spec"
|
45
|
-
#
|
46
|
-
# RSpec.describe Integer do
|
47
|
-
# let(:answer) { 42 }
|
48
|
-
#
|
49
|
-
# it "returns the value" do
|
50
|
-
# expect(answer).to be(42)
|
51
|
-
# end
|
52
|
-
#
|
53
|
-
# context "when the number is incremented" do
|
54
|
-
# let(:answer) { super().next }
|
55
|
-
#
|
56
|
-
# it "returns the next value" do
|
57
|
-
# expect(answer).to be(43)
|
58
|
-
# end
|
59
|
-
# end
|
60
|
-
# end
|
61
|
-
#
|
62
|
-
# # Output to the console
|
63
|
-
# # Success: expected to be 42.
|
64
|
-
# # Success: expected to be 43.
|
65
|
-
#
|
66
|
-
# @api public
|
4
|
+
# @see https://github.com/cyril/r_spec-clone.rb
|
67
5
|
module RSpec
|
68
|
-
# Defines an example group that establishes a specific context, like _empty
|
69
|
-
# array_ versus _array with elements_.
|
70
|
-
#
|
71
|
-
# Unlike {.describe}, the block is evaluated in isolation in order to scope
|
72
|
-
# possible side effects inside its context.
|
73
|
-
#
|
74
|
-
# @example
|
75
|
-
# require "r_spec"
|
76
|
-
#
|
77
|
-
# RSpec.context "when divided by zero" do
|
78
|
-
# subject { 42 / 0 }
|
79
|
-
#
|
80
|
-
# it { is_expected.to raise_exception ZeroDivisionError }
|
81
|
-
# end
|
82
|
-
#
|
83
|
-
# # Output to the console
|
84
|
-
# # Success: divided by 0.
|
85
|
-
#
|
86
|
-
# @param description [String] A description that usually begins with "when",
|
87
|
-
# "with" or "without".
|
88
|
-
# @param block [Proc] The block to define the specs.
|
89
|
-
#
|
90
|
-
# @api public
|
91
|
-
def self.context(description, &block)
|
92
|
-
Dsl.context(description, &block)
|
93
|
-
end
|
94
|
-
|
95
|
-
# Defines an example group that describes a unit to be tested.
|
96
|
-
#
|
97
|
-
# @example
|
98
|
-
# require "r_spec"
|
99
|
-
#
|
100
|
-
# RSpec.describe String do
|
101
|
-
# describe "+" do
|
102
|
-
# it("concats") { expect("foo" + "bar").to eq "foobar" }
|
103
|
-
# end
|
104
|
-
# end
|
105
|
-
#
|
106
|
-
# # Output to the console
|
107
|
-
# # Success: expected to eq "foobar".
|
108
|
-
#
|
109
|
-
# @param const [Module, String] A module to include in block context.
|
110
|
-
# @param block [Proc] The block to define the specs.
|
111
|
-
#
|
112
|
-
# @api public
|
113
|
-
def self.describe(const, &block)
|
114
|
-
Dsl.describe(const, &block)
|
115
|
-
end
|
116
|
-
|
117
|
-
# Defines a concrete test case.
|
118
|
-
#
|
119
|
-
# The test is performed by the block supplied to &block.
|
120
|
-
#
|
121
|
-
# @example The integer after 41
|
122
|
-
# require "r_spec"
|
123
|
-
#
|
124
|
-
# RSpec.it { expect(41.next).to be 42 }
|
125
|
-
#
|
126
|
-
# # Output to the console
|
127
|
-
# # Success: expected to be 42.
|
128
|
-
#
|
129
|
-
# It is usually used inside a {Dsl.describe} or {Dsl.context} section.
|
130
|
-
#
|
131
|
-
# @param name [String, nil] The name of the spec.
|
132
|
-
# @param block [Proc] An expectation to evaluate.
|
133
|
-
#
|
134
|
-
# @raise (see RSpec::ExpectationTarget::Base#result)
|
135
|
-
# @return (see RSpec::ExpectationTarget::Base#result)
|
136
|
-
#
|
137
|
-
# @api public
|
138
|
-
def self.it(name = nil, &block)
|
139
|
-
Dsl.it(name, &block)
|
140
|
-
end
|
141
|
-
|
142
|
-
# Defines a pending test case.
|
143
|
-
#
|
144
|
-
# `&block` is never evaluated. It can be used to describe behaviour that is
|
145
|
-
# not yet implemented.
|
146
|
-
#
|
147
|
-
# @example
|
148
|
-
# require "r_spec"
|
149
|
-
#
|
150
|
-
# RSpec.pending "is implemented but waiting" do
|
151
|
-
# expect something to be finished
|
152
|
-
# end
|
153
|
-
#
|
154
|
-
# RSpec.pending "is not yet implemented and waiting"
|
155
|
-
#
|
156
|
-
# # Output to the console
|
157
|
-
# # Warning: is implemented but waiting.
|
158
|
-
# # Warning: is not yet implemented and waiting.
|
159
|
-
#
|
160
|
-
# It is usually used inside a {Dsl.describe} or {Dsl.context} section.
|
161
|
-
#
|
162
|
-
# @param message [String] The reason why the example is pending.
|
163
|
-
#
|
164
|
-
# @return [nil] Write a message to STDOUT.
|
165
|
-
#
|
166
|
-
# @api public
|
167
|
-
def self.pending(message)
|
168
|
-
Dsl.pending(message)
|
169
|
-
end
|
170
6
|
end
|
7
|
+
|
8
|
+
require "r_spec/clone"
|
metadata
CHANGED
@@ -1,71 +1,29 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: r_spec-clone
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.12
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.12
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: expresenter
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.3.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.3.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: matchi-rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.1.2
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.1.2
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: test_tube
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
17
|
+
- - ">="
|
60
18
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
19
|
+
version: '0'
|
62
20
|
type: :runtime
|
63
21
|
prerelease: false
|
64
22
|
version_requirements: !ruby/object:Gem::Requirement
|
65
23
|
requirements:
|
66
|
-
- - "
|
24
|
+
- - ">="
|
67
25
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
26
|
+
version: '0'
|
69
27
|
- !ruby/object:Gem::Dependency
|
70
28
|
name: bundler
|
71
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,33 +159,14 @@ files:
|
|
201
159
|
- LICENSE.md
|
202
160
|
- README.md
|
203
161
|
- lib/r_spec.rb
|
204
|
-
- lib/r_spec/console.rb
|
205
|
-
- lib/r_spec/dsl.rb
|
206
|
-
- lib/r_spec/error.rb
|
207
|
-
- lib/r_spec/error/pending_expectation.rb
|
208
|
-
- lib/r_spec/error/reserved_method.rb
|
209
|
-
- lib/r_spec/error/undefined_described_class.rb
|
210
|
-
- lib/r_spec/error/undefined_subject.rb
|
211
|
-
- lib/r_spec/expectation_helper.rb
|
212
|
-
- lib/r_spec/expectation_helper/it.rb
|
213
|
-
- lib/r_spec/expectation_helper/its.rb
|
214
|
-
- lib/r_spec/expectation_helper/shared.rb
|
215
|
-
- lib/r_spec/expectation_target.rb
|
216
|
-
- lib/r_spec/expectation_target/base.rb
|
217
|
-
- lib/r_spec/expectation_target/block.rb
|
218
|
-
- lib/r_spec/expectation_target/value.rb
|
219
162
|
homepage: https://r-spec.dev/
|
220
163
|
licenses:
|
221
164
|
- MIT
|
222
165
|
metadata:
|
223
|
-
bug_tracker_uri: https://github.com/cyril/r_spec
|
224
|
-
|
225
|
-
|
226
|
-
|
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!
|
166
|
+
bug_tracker_uri: https://github.com/cyril/r_spec.rb/issues
|
167
|
+
source_code_uri: https://github.com/cyril/r_spec.rb
|
168
|
+
rubygems_mfa_required: 'true'
|
169
|
+
post_install_message:
|
231
170
|
rdoc_options: []
|
232
171
|
require_paths:
|
233
172
|
- lib
|
@@ -235,14 +174,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
174
|
requirements:
|
236
175
|
- - ">="
|
237
176
|
- !ruby/object:Gem::Version
|
238
|
-
version:
|
177
|
+
version: 3.0.4
|
239
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
179
|
requirements:
|
241
180
|
- - ">="
|
242
181
|
- !ruby/object:Gem::Version
|
243
182
|
version: '0'
|
244
183
|
requirements: []
|
245
|
-
rubygems_version: 3.
|
184
|
+
rubygems_version: 3.2.33
|
246
185
|
signing_key:
|
247
186
|
specification_version: 4
|
248
187
|
summary: A minimalist RSpec clone
|
data/lib/r_spec/console.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RSpec
|
4
|
-
# Send log messages to the console.
|
5
|
-
#
|
6
|
-
# @api private
|
7
|
-
module Console
|
8
|
-
# @param report [::Expresenter::Pass] Passed expectation result presenter.
|
9
|
-
#
|
10
|
-
# @see https://github.com/fixrb/expresenter
|
11
|
-
#
|
12
|
-
# @return [nil] Add a colored message to `$stdout`.
|
13
|
-
def self.passed_spec(report)
|
14
|
-
puts report.colored_string
|
15
|
-
end
|
16
|
-
|
17
|
-
# @param report [::Expresenter::Fail] Failed expectation result presenter.
|
18
|
-
#
|
19
|
-
# @see https://github.com/fixrb/expresenter
|
20
|
-
#
|
21
|
-
# @raise [SystemExit] Terminate execution immediately with colored message.
|
22
|
-
def self.failed_spec(report)
|
23
|
-
abort report.colored_string
|
24
|
-
end
|
25
|
-
|
26
|
-
# The Ruby source filename and line number containing this method or nil if
|
27
|
-
# this method was not defined in Ruby (i.e. native).
|
28
|
-
#
|
29
|
-
# @param filename [String, nil] The Ruby source filename.
|
30
|
-
# @param line [Integer, nil] The Ruby source line number.
|
31
|
-
#
|
32
|
-
# @return [String] The Ruby source filename and line number associated with
|
33
|
-
# the evaluated spec.
|
34
|
-
def self.source(filename, line)
|
35
|
-
puts [filename, line].compact.join(":")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|