r_spec 1.0.1 → 1.0.4

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: d4d1385151395cd826a177727b3b30e49d3c6a6987a1917227818f9e86893342
4
- data.tar.gz: 96382fb495444187b3c9b1d927a08fa23a2991b208e016cb308b53a32f89df3b
3
+ metadata.gz: 06e4fca8d3ac445a345995ef83326fd9627fe438c5b712343ccfc2b04f475e8f
4
+ data.tar.gz: f06268504b401ec16c575df69637141b6ad14af67c217059a4383376651c0e21
5
5
  SHA512:
6
- metadata.gz: 3481f838c965908f205e134ae8884925f64b7d2943cbf3efbd1298b00089775b75be049e15b7bdc9014967190d1def4fa13dd276b31a0b447179dafb93d1749c
7
- data.tar.gz: 5191b6e4e55a363835c3f0e4e6cc30426a6852e2aa73c7e8071b71662d9c43b226fe8cba81a09f5fda1442a99ae3da585cd7a85c7b858c4a5fd99a389c4ef28e
6
+ metadata.gz: e8f3551cf97eb212ae68ab09d6ab1f633bd8b4770a8ad29131bf17143ac897df487e7928a1e8f61c06c0c05f791be07ffe1c3cae1706a3686116ef577e61f032
7
+ data.tar.gz: 5a1d5e24bde9be03408cfde4c651700048b1285e7b8917a27c9763f97ced1acb901c519fd51a3ef8acdd780eb7025789d22db3ad7f96eced5847908b27fda9cb
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ # The MIT License
2
2
 
3
- Copyright (c) 2015-2021 Cyril Kato
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,31 @@
1
1
  # RSpec clone
2
2
 
3
- A minimalist __RSpec clone__ with all the essentials.
3
+ > A small [RSpec](https://github.com/rspec) clone based on [Fix testing tools for Ruby](https://github.com/fixrb).
4
4
 
5
- ## Important ⚠️
5
+ ## Status
6
6
 
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!
7
+ [![Home](https://img.shields.io/badge/Home-r--spec.dev-00af8b)](https://r-spec.dev/)
8
+ [![Version](https://img.shields.io/github/v/tag/cyril/r_spec.rb?label=Version&logo=github)](https://github.com/cyril/r_spec.rb/tags)
9
+ [![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/cyril/r_spec.rb/main)
10
+ [![Ruby](https://github.com/cyril/r_spec.rb/workflows/Ruby/badge.svg?branch=main)](https://github.com/cyril/r_spec.rb/actions?query=workflow%3Aruby+branch%3Amain)
11
+ [![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)
12
+ [![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)
10
13
 
11
- ## Project goals
14
+ ## Warning ⚠️
12
15
 
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.
16
+ 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).
17
17
 
18
- ## Some differences
18
+ 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.
19
19
 
20
- * Spec files can be executed with `ruby` directly.
21
- * There is no option to activate monkey-patching.
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.
23
- * Built-in matchers [do not trust _actual_](https://asciinema.org/a/29172?autoplay=1&speed=2) and do not send it messages.
24
- * If no `subject` has been explicitly determined, none is defined.
25
- * If no described class is set, `described_class` is undefined instead of `nil`.
26
- * Expectations cannot be added inside a `before` block.
27
- * [Arbitrary helper methods](https://relishapp.com/rspec/rspec-core/v/3-10/docs/helper-methods/arbitrary-helper-methods) are not exposed to examples.
28
- * The `let` method defines a helper method rather than a memoized helper method.
29
- * The one-liner `is_expected` syntax also works with block expectations.
30
- * `subject`, `before`, `after` and `let` definitions must come before examples.
31
- * Each [`context` runs its tests in _isolation_](https://asciinema.org/a/29070?autoplay=1&speed=2) to prevent side effects.
20
+ ![On the job](https://github.com/cyril/r_spec.rb/raw/main/img/on-the-job.jpg)
21
+
22
+ 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).
23
+
24
+ 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.
25
+
26
+ ## Why did I redid that?
27
+
28
+ 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
29
 
33
30
  ## Installation
34
31
 
@@ -41,7 +38,7 @@ gem "r_spec"
41
38
  And then execute:
42
39
 
43
40
  ```sh
44
- bundle
41
+ bundle install
45
42
  ```
46
43
 
47
44
  Or install it yourself as:
@@ -50,206 +47,80 @@ Or install it yourself as:
50
47
  gem install r_spec
51
48
  ```
52
49
 
53
- ## Overview
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
- [![RSpec clone demo](https://asciinema.org/a/422210.svg)](https://asciinema.org/a/422210?autoplay=1&speed=2)
62
-
63
- ## Usage
64
-
65
- ### Anatomy of a spec file
66
-
67
- To use the `RSpec` module and its DSL, you need to add `require "r_spec"` to your spec files.
68
- Many projects use a custom spec helper which organizes these includes.
69
-
70
- Concrete test cases are defined in `it` blocks.
71
- An optional descriptive string states it's purpose and a block contains the main logic performing the test.
72
-
73
- Test cases that have been defined or outlined but are not yet expected to work can be defined using `pending` instead of `it`. They will not be run but show up in the spec report as pending.
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
100
-
101
- ```ruby
102
- expect(actual).to eql(expected) # passes if expected.eql?(actual)
103
- expect(actual).to eq(expected) # passes if expected.eql?(actual)
104
- ```
105
-
106
- #### Identity
107
-
108
- ```ruby
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
50
+ ## Update
120
51
 
121
- ```ruby
122
- expect { actual }.to raise_exception(expected) # passes if expected exception is raised
123
- ```
124
-
125
- #### Truth
52
+ All the code is centralized in the `RSpec::Clone` module, whose source code is versioned at <https://github.com/cyril/r_spec-clone.rb>.
126
53
 
127
- ```ruby
128
- expect(actual).to be_true # passes if true.equal?(actual)
129
- ```
54
+ To download the latest updates of the [r_spec-clone](https://rubygems.org/gems/r_spec-clone) gem, this command can be executed:
130
55
 
131
- #### Untruth
132
-
133
- ```ruby
134
- expect(actual).to be_false # passes if false.equal?(actual)
135
- ```
136
-
137
- #### Nil
138
-
139
- ```ruby
140
- expect(actual).to be_nil # passes if nil.equal?(actual)
141
- ```
142
-
143
- #### Type/class
144
-
145
- ```ruby
146
- expect(actual).to be_instance_of(expected) # passes if expected.equal?(actual.class)
147
- expect(actual).to be_an_instance_of(expected) # passes if expected.equal?(actual.class)
56
+ ```sh
57
+ bundle update r_spec
148
58
  ```
149
59
 
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`:
60
+ Or update it yourself as:
160
61
 
161
62
  ```sh
162
- bundle exec rake spec
63
+ gem update r_spec
163
64
  ```
164
65
 
165
- Run a single file:
66
+ ## Usage
166
67
 
167
- ```sh
168
- ruby spec/my/test/file_spec.rb
169
- ```
68
+ Let's imagine a `string_hello_world_spec.rb` file that contains this code:
170
69
 
171
- It is not recommended, but the RSpec's [`rspec` command line](https://relishapp.com/rspec/rspec-core/docs/command-line) might also work:
70
+ ```ruby
71
+ # frozen_string_literal: false
172
72
 
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
- ```
73
+ require "r_spec"
179
74
 
180
- ### Spec helper
75
+ app = "Hello, World!"
181
76
 
182
- Many projects use a custom spec helper file, usually named `spec/spec_helper.rb`.
77
+ RSpec.describe String do
78
+ subject do
79
+ app
80
+ end
183
81
 
184
- This file is used to require `r_spec` and other includes, like the code from the project needed for every spec file.
82
+ before do
83
+ subject.gsub!("World", friend)
84
+ end
185
85
 
186
- ### Rake integration example
86
+ context "when Alice is greeted" do
87
+ let(:friend) { "Alice" }
187
88
 
188
- The following `Rakefile` settings should be enough:
89
+ it { is_expected.to eq "Hello, Alice!" }
90
+ end
189
91
 
190
- ```ruby
191
- require "bundler/gem_tasks"
192
- require "rake/testtask"
92
+ context "when Bob is greeted" do
93
+ let(:friend) { "Bob" }
193
94
 
194
- Rake::TestTask.new do |t|
195
- t.pattern = "spec/**/*_spec.rb"
95
+ it { is_expected.to eq "Hello, Bob!" }
96
+ end
196
97
  end
197
-
198
- task spec: :test
199
- task default: :test
200
98
  ```
201
99
 
202
- And then execute:
100
+ We can run it with Ruby:
203
101
 
204
102
  ```sh
205
- bundle exec rake
103
+ ruby string_hello_world_spec.rb
206
104
  ```
207
105
 
208
- ## Performance
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
- ![Runtime](https://clone.r-spec.dev/benchmark-runtime.png)
215
-
216
- ## Test suite
217
-
218
- __RSpec clone__'s specifications are self-described here: [spec/](https://github.com/cyril/r_spec-clone.rb/blob/main/spec/)
219
-
220
- ## Contact
106
+ The report of the execution should be:
221
107
 
222
- * Home page: [https://r-spec.dev/](https://r-spec.dev/)
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)
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 ☕
108
+ ```txt
109
+ string_hello_world_spec.rb:19
110
+ Success: expected to eq "Hello, Alice!".
111
+ string_hello_world_spec.rb:25
112
+ Success: expected to eq "Hello, Bob!".
113
+ ```
236
114
 
237
- If you like this project, please consider making a small donation to Batman.
115
+ ## External links
238
116
 
239
- [![Donate](https://img.shields.io/badge/Donate-batman.eth-purple.svg)](https://etherscan.io/address/batman.eth)
117
+ * [Official RSpec project](https://rspec.info/)
118
+ * [Personal RSpec reimplementation](https://r-spec.dev/)
240
119
 
241
120
  ## Versioning
242
121
 
243
- __RSpec clone__ follows [Semantic Versioning 2.0](https://semver.org/).
122
+ __RSpec__ uses [Semantic Versioning 2.0.0](https://semver.org/)
244
123
 
245
124
  ## License
246
125
 
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).
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
- ![Fix testing tools logo for Ruby](https://github.com/cyril/r_spec-clone.rb/raw/main/img/fixrb.svg)
126
+ 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,7 +1,5 @@
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
4
  #
7
5
  # @example The true from the false
@@ -14,157 +12,8 @@ require_relative File.join("r_spec", "dsl")
14
12
  # # Output to the console
15
13
  # # Success: expected false not to be true.
16
14
  #
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
15
+ # @see https://github.com/cyril/r_spec-clone.rb
67
16
  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
17
  end
18
+
19
+ 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.1
4
+ version: 1.0.4
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-27 00:00:00.000000000 Z
11
+ date: 2022-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aw
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: 1.1.0
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: 1.1.0
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-clone.rb/issues
224
- documentation_uri: https://rubydoc.info/gems/r_spec
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!
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
@@ -242,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
242
181
  - !ruby/object:Gem::Version
243
182
  version: '0'
244
183
  requirements: []
245
- rubygems_version: 3.1.6
184
+ rubygems_version: 3.1.2
246
185
  signing_key:
247
186
  specification_version: 4
248
187
  summary: A minimalist RSpec clone
@@ -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