r_spec 0.3.3 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/README.md +51 -78
- data/lib/r_spec.rb +5 -22
- data/lib/r_spec/dsl.rb +80 -0
- data/lib/r_spec/exam.rb +29 -0
- data/lib/r_spec/expect.rb +19 -0
- data/lib/r_spec/pending.rb +8 -0
- data/lib/r_spec/requirement.rb +90 -0
- data/lib/r_spec/test.rb +10 -0
- metadata +89 -74
- data/.gitignore +0 -11
- data/.rubocop.yml +0 -1
- data/.rubocop_todo.yml +0 -28
- data/.travis.yml +0 -26
- data/.yardopts +0 -1
- data/CODE_OF_CONDUCT.md +0 -13
- data/Gemfile +0 -5
- data/Rakefile +0 -22
- data/VERSION.semver +0 -1
- data/bin/console +0 -8
- data/bin/setup +0 -5
- data/checksum/r_spec-0.1.0.gem.sha512 +0 -1
- data/checksum/r_spec-0.1.1.gem.sha512 +0 -1
- data/checksum/r_spec-0.2.0.gem.sha512 +0 -1
- data/checksum/r_spec-0.3.0.gem.sha512 +0 -1
- data/checksum/r_spec-0.3.1.gem.sha512 +0 -1
- data/checksum/r_spec-0.3.2.gem.sha512 +0 -1
- data/lib/fix/it.rb +0 -12
- data/lib/fix/on.rb +0 -45
- data/pkg_checksum +0 -12
- data/r_spec.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ffdec1b2b30ba9271129d9332872597dbc00204d92495e4cbfa1f3b00896d8f
|
4
|
+
data.tar.gz: 59c6a96b46b865ea72ecd3b84f80189f8173550447bed8820e1156130ba02c67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60c275a1bbe617d37623707f45cd7d8cb0673354a7e1751873ecf08e84160f77030530a284b0d759cb32705599a64d5a0bb2287acd10c8dbb3bd0f8b0a1328fa
|
7
|
+
data.tar.gz: 19f8fa7e5727b596a11d2865fedf26953198d09604cdc2150ef037e88d78913305c5a257d4289e270a3697f4555524973df46ea081da1502082c25b864704a4d
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,129 +1,102 @@
|
|
1
|
-
#
|
1
|
+
# RSpec clone
|
2
2
|
|
3
|
-
[
|
4
|
-
[![Code Climate](https://codeclimate.com/github/cyril/r_spec/badges/gpa.svg)][codeclimate]
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/r_spec.svg)][gem]
|
6
|
-
[![Inline docs](https://inch-ci.org/github/cyril/r_spec.svg?branch=master)][inchpages]
|
7
|
-
[![Documentation](https://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
|
3
|
+
A minimalist [RSpec](https://github.com/rspec/rspec) clone with an emphasis on correctness and simplicity.
|
8
4
|
|
9
|
-
|
5
|
+
![What did you expect?](https://github.com/cyril/r_spec.rb/raw/main/img/what-did-you-expect.jpg)
|
10
6
|
|
11
|
-
|
7
|
+
## Status
|
12
8
|
|
13
|
-
|
9
|
+
[![Gem Version](https://badge.fury.io/rb/r_spec.svg)](https://badge.fury.io/rb/r_spec)
|
10
|
+
[![Build Status](https://travis-ci.org/cyril/r_spec.rb.svg?branch=main)](https://travis-ci.org/cyril/r_spec.rb)
|
11
|
+
[![Inline Docs](https://inch-ci.org/github/cyril/r_spec.rb.svg)](https://inch-ci.org/github/cyril/r_spec.rb)
|
14
12
|
|
15
|
-
|
13
|
+
## Goal
|
16
14
|
|
17
|
-
This
|
15
|
+
This clone attempts to provide most of RSpec's DSL without magic power, so that its code could reasonably become less complex than the code of your application.
|
18
16
|
|
19
|
-
|
17
|
+
## Some differences
|
20
18
|
|
21
|
-
|
19
|
+
* Less features and an implementation with much less code complexity.
|
20
|
+
* Spec files can also be executed directly with the `ruby` executable.
|
21
|
+
* There cannot be more than one expectation per example.
|
22
|
+
* There is no option to activate monkey-patching.
|
23
|
+
* Does not rely on hacks such as `at_exit` hook to trigger the tests.
|
24
|
+
* Built-in matchers do not trust _actual_ and do not send it any message.
|
22
25
|
|
23
|
-
##
|
24
|
-
|
25
|
-
* Home page: https://github.com/cyril/r_spec
|
26
|
-
* Bugs/issues: https://github.com/cyril/r_spec/issues
|
27
|
-
|
28
|
-
## Rubies
|
29
|
-
|
30
|
-
* [MRI](https://www.ruby-lang.org/)
|
31
|
-
* [Rubinius](https://rubinius.com/)
|
32
|
-
* [JRuby](https://www.jruby.org/)
|
33
|
-
|
34
|
-
## Terminal sessions
|
26
|
+
## Important ⚠️
|
35
27
|
|
36
|
-
|
28
|
+
To avoid confusion in the community, please note that:
|
37
29
|
|
38
|
-
|
30
|
+
- the gem of this project is **not [`rspec`](https://rubygems.org/gems/rspec)**,
|
31
|
+
it is **[`r_spec`](https://rubygems.org/gems/r_spec)**;
|
32
|
+
- this project is totally independent of [rspec.info](https://rspec.info/).
|
39
33
|
|
40
|
-
|
34
|
+
### Note
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
Unbelievable but true, sometimes "💩" is equal to 42.
|
45
|
-
|
46
|
-
Although fun, this _feature_ can be fixed pretty easily...
|
47
|
-
|
48
|
-
[![Fix RSpec!](https://asciinema.org/a/29172.png)](https://asciinema.org/a/29172)
|
36
|
+
Following [RubyGems naming conventions](https://guides.rubygems.org/name-your-gem/#use-underscores-for-multiple-words), the module name for this project is `RSpec`.
|
49
37
|
|
50
38
|
## Installation
|
51
39
|
|
52
40
|
Add this line to your application's Gemfile:
|
53
41
|
|
54
42
|
```ruby
|
55
|
-
gem
|
43
|
+
gem "r_spec", ">= 1.0.0.beta1"
|
56
44
|
```
|
57
45
|
|
58
46
|
And then execute:
|
59
47
|
|
60
|
-
|
48
|
+
```sh
|
49
|
+
bundle
|
50
|
+
```
|
61
51
|
|
62
52
|
Or install it yourself as:
|
63
53
|
|
64
|
-
|
54
|
+
```sh
|
55
|
+
gem install r_spec --pre
|
56
|
+
```
|
65
57
|
|
66
58
|
## Usage
|
67
59
|
|
68
60
|
Given this `greeting_spec.rb` spec:
|
69
61
|
|
70
62
|
```ruby
|
71
|
-
require
|
63
|
+
require "r_spec"
|
72
64
|
|
73
|
-
greeting =
|
65
|
+
greeting = "Hello, world!"
|
74
66
|
|
75
|
-
RSpec.describe
|
76
|
-
context
|
77
|
-
before { greeting.gsub!(
|
78
|
-
it { expect(greeting).to eql
|
67
|
+
RSpec.describe String do
|
68
|
+
context "Alice" do
|
69
|
+
before { greeting.gsub!("world", "Alice") }
|
70
|
+
it { expect(greeting).to eql "Hello, Alice!" }
|
79
71
|
end
|
80
72
|
|
81
|
-
context
|
82
|
-
before { greeting.gsub!(
|
83
|
-
it { expect(greeting).to eql
|
73
|
+
context "Bob" do
|
74
|
+
before { greeting.gsub!("world", "Bob") }
|
75
|
+
it { expect(greeting).to eql "Hello, Bob!" }
|
84
76
|
end
|
85
77
|
end
|
86
78
|
```
|
87
79
|
|
88
80
|
It can be tested in the console with the command:
|
89
81
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
Ran 2 tests in 0.010994 seconds
|
94
|
-
100% compliant - 0 infos, 0 failures, 0 errors
|
95
|
-
|
96
|
-
## Security
|
82
|
+
```sh
|
83
|
+
ruby greeting_spec.rb
|
84
|
+
```
|
97
85
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
86
|
+
> ..
|
87
|
+
>
|
88
|
+
> Ran 2 tests in 0.010994 seconds
|
89
|
+
> 100% compliant - 0 infos, 0 failures, 0 errors
|
102
90
|
|
103
|
-
|
104
|
-
example:
|
91
|
+
## Contact
|
105
92
|
|
106
|
-
|
107
|
-
|
93
|
+
* Home page: https://r-spec.dev/
|
94
|
+
* Source code: https://github.com/cyril/r_spec.rb
|
108
95
|
|
109
96
|
## Versioning
|
110
97
|
|
111
|
-
|
112
|
-
|
113
|
-
## Contributing
|
114
|
-
|
115
|
-
1. [Fork it](https://github.com/cyril/r_spec/fork)
|
116
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
117
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
118
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
119
|
-
5. Create a new Pull Request
|
98
|
+
__R_Spec__ follows [Semantic Versioning 2.0](https://semver.org/).
|
120
99
|
|
121
100
|
## License
|
122
101
|
|
123
|
-
|
124
|
-
|
125
|
-
[gem]: https://rubygems.org/gems/r_spec
|
126
|
-
[travis]: https://travis-ci.org/cyril/r_spec
|
127
|
-
[codeclimate]: https://codeclimate.com/github/cyril/r_spec
|
128
|
-
[inchpages]: https://inch-ci.org/github/cyril/r_spec
|
129
|
-
[rubydoc]: https://www.rubydoc.info/gems/r_spec/frames
|
102
|
+
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,33 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require 'fix/expect'
|
5
|
-
require 'fix/its'
|
6
|
-
|
7
|
-
# Namespace for the R Spec framework.
|
3
|
+
# Namespace for the RSpec framework.
|
8
4
|
#
|
9
5
|
# @api public
|
10
6
|
#
|
11
7
|
module RSpec
|
12
8
|
# Specs are built with this method.
|
13
|
-
|
14
|
-
|
15
|
-
# describe('the answer') do
|
16
|
-
# it { expect(42).to be 42 }
|
17
|
-
# end
|
18
|
-
#
|
19
|
-
# @param front_object [#object_id] The front object.
|
20
|
-
# @param options [Hash] Some options.
|
21
|
-
# @param specs [Proc] The set of specs.
|
22
|
-
#
|
23
|
-
# @raise [SystemExit] The result of the test.
|
24
|
-
def self.describe(front_object, options = {}, &specs)
|
25
|
-
t = ::Fix::Test.new(front_object, options, &specs)
|
9
|
+
def self.describe(const, &block)
|
10
|
+
raise ::TypeError, const.class.inspect unless const.is_a?(::Module)
|
26
11
|
|
27
|
-
|
28
|
-
exit t.pass?
|
12
|
+
DSL.describe(const, &block)
|
29
13
|
end
|
30
14
|
end
|
31
15
|
|
32
|
-
require_relative File.join
|
33
|
-
require_relative File.join 'fix', 'on'
|
16
|
+
require_relative File.join("r_spec", "dsl")
|
data/lib/r_spec/dsl.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "expresenter"
|
4
|
+
require "matchi/rspec"
|
5
|
+
require "securerandom"
|
6
|
+
|
7
|
+
module RSpec
|
8
|
+
class DSL
|
9
|
+
def self.before(&block)
|
10
|
+
define_method(:initialize) do |*args, **kwargs|
|
11
|
+
super()
|
12
|
+
instance_exec(*args, **kwargs, &block)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.let(name, &block)
|
17
|
+
protected define_method(name.to_sym, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.subject(&block)
|
21
|
+
let(__method__, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.describe(const, &block)
|
25
|
+
desc = Test.const_set("Test#{random_str}", ::Class.new(self))
|
26
|
+
|
27
|
+
if const.is_a?(::Module)
|
28
|
+
desc.define_method(:described_class) { const }
|
29
|
+
desc.send(:protected, :described_class)
|
30
|
+
end
|
31
|
+
|
32
|
+
desc.instance_eval(&block)
|
33
|
+
desc
|
34
|
+
end
|
35
|
+
|
36
|
+
singleton_class.send(:alias_method, :context, :describe)
|
37
|
+
|
38
|
+
def self.it(name = "test_#{random_str.downcase}", &block)
|
39
|
+
raise ::ArgumentError, "Missing block for #{name.inspect} test" unless block
|
40
|
+
|
41
|
+
path_info = block.source_location.join(":")
|
42
|
+
print "\e[3m#{path_info}\e[23m "
|
43
|
+
|
44
|
+
i = example.new
|
45
|
+
i.instance_eval(&block)
|
46
|
+
end
|
47
|
+
|
48
|
+
private_class_method def self.example
|
49
|
+
::Class.new(self) do
|
50
|
+
include ::Matchi::Helper
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def expect(actual)
|
55
|
+
undef expect
|
56
|
+
undef is_expected
|
57
|
+
|
58
|
+
Expect.new(actual)
|
59
|
+
end
|
60
|
+
|
61
|
+
# rubocop:disable Naming/PredicateName
|
62
|
+
def is_expected
|
63
|
+
expect(subject)
|
64
|
+
end
|
65
|
+
# rubocop:enable Naming/PredicateName
|
66
|
+
|
67
|
+
def pending(description)
|
68
|
+
puts Requirement.pending(description).colored_string
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
private_class_method def self.random_str
|
74
|
+
::SecureRandom.alphanumeric(5)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
require_relative "expect"
|
80
|
+
require_relative "test"
|
data/lib/r_spec/exam.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
# This class evaluate the expectation with the given value.
|
5
|
+
class Exam
|
6
|
+
# Execute the untested code from the given value against the matcher.
|
7
|
+
#
|
8
|
+
# @param actual [#object_id] The actual object to test.
|
9
|
+
# @param negate [Boolean] Positive or negative assertion?
|
10
|
+
# @param matcher [#matches?] The matcher.
|
11
|
+
def initialize(actual:, negate:, matcher:)
|
12
|
+
@actual = actual
|
13
|
+
@got = negate ^ matcher.matches? { actual }
|
14
|
+
end
|
15
|
+
# @return [#object_id] The actual value.
|
16
|
+
attr_reader :actual
|
17
|
+
|
18
|
+
# @return [Boolean] Report to the spec requirement level if the
|
19
|
+
# expectation is true or false.
|
20
|
+
attr_reader :got
|
21
|
+
|
22
|
+
# Report to the spec requirement if the test pass or fail.
|
23
|
+
#
|
24
|
+
# @return [Boolean] Report if the test pass or fail?
|
25
|
+
def valid?
|
26
|
+
got
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
class Expect
|
5
|
+
def initialize(actual)
|
6
|
+
@actual = actual
|
7
|
+
end
|
8
|
+
|
9
|
+
def to(matcher)
|
10
|
+
Requirement.new(actual: @actual, matcher: matcher, negate: false).call
|
11
|
+
end
|
12
|
+
|
13
|
+
def not_to(matcher)
|
14
|
+
Requirement.new(actual: @actual, matcher: matcher, negate: true).call
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require_relative "requirement"
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "expresenter"
|
4
|
+
|
5
|
+
module RSpec
|
6
|
+
class Requirement
|
7
|
+
def self.pending(description)
|
8
|
+
::Expresenter.call(true).new(
|
9
|
+
actual: nil,
|
10
|
+
error: Pending.new(description),
|
11
|
+
expected: nil,
|
12
|
+
got: nil,
|
13
|
+
matcher: :eql,
|
14
|
+
negate: false,
|
15
|
+
level: :MAY,
|
16
|
+
valid: false
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Initialize the requirement class.
|
21
|
+
#
|
22
|
+
# @param actual [#object_id] The actual object to test.
|
23
|
+
# @param matcher [#matches?] The matcher.
|
24
|
+
# @param negate [Boolean] Positive or negative assertion?
|
25
|
+
def initialize(actual:, matcher:, negate:)
|
26
|
+
@exam = Exam.new(actual: actual, negate: negate, matcher: matcher)
|
27
|
+
@matcher = matcher
|
28
|
+
@negate = negate
|
29
|
+
@result = expectation_result
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Exam] The exam.
|
33
|
+
attr_reader :exam
|
34
|
+
|
35
|
+
# @return [#matches?] The matcher that performed a boolean comparison
|
36
|
+
# between the actual value and the expected value.
|
37
|
+
attr_reader :matcher
|
38
|
+
|
39
|
+
# @return [Expresenter::Fail, Expresenter::Pass] The test result.
|
40
|
+
attr_reader :result
|
41
|
+
|
42
|
+
# Evaluate the expectation.
|
43
|
+
#
|
44
|
+
# @return [Boolean] Report if the expectation pass or fail?
|
45
|
+
def pass?
|
46
|
+
exam.valid?
|
47
|
+
end
|
48
|
+
|
49
|
+
# The consequence of the expectation.
|
50
|
+
#
|
51
|
+
# @return [nil] The test passed.
|
52
|
+
# @raise [SystemExit] The test failed.
|
53
|
+
def call
|
54
|
+
if result.passed?
|
55
|
+
puts result.colored_string
|
56
|
+
else
|
57
|
+
abort result.colored_string
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
protected
|
62
|
+
|
63
|
+
# @note The boolean comparison between the actual value and the expected
|
64
|
+
# value can be evaluated to a negative assertion.
|
65
|
+
#
|
66
|
+
# @return [Boolean] Positive or negative assertion?
|
67
|
+
def negate?
|
68
|
+
@negate
|
69
|
+
end
|
70
|
+
|
71
|
+
# The result of the expectation.
|
72
|
+
#
|
73
|
+
# @return [Expresenter::Fail, Expresenter::Pass] The test result.
|
74
|
+
def expectation_result
|
75
|
+
::Expresenter.call(pass?).new(
|
76
|
+
actual: exam.actual,
|
77
|
+
error: nil,
|
78
|
+
expected: matcher.expected,
|
79
|
+
got: exam.got,
|
80
|
+
negate: negate?,
|
81
|
+
valid: exam.valid?,
|
82
|
+
matcher: matcher.class.to_sym,
|
83
|
+
level: :MUST
|
84
|
+
)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
require_relative "exam"
|
90
|
+
require_relative "pending"
|
data/lib/r_spec/test.rb
ADDED
metadata
CHANGED
@@ -1,176 +1,191 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.beta1
|
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: 2021-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: expresenter
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: matchi-rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0
|
48
|
-
type: :
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rubocop-md
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
84
|
+
name: rubocop-performance
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rubocop-rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rubocop-rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-thread_safety
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
154
|
name: yard
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
|
-
- - "
|
157
|
+
- - ">="
|
130
158
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0
|
159
|
+
version: '0'
|
132
160
|
type: :development
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
135
163
|
requirements:
|
136
|
-
- - "
|
164
|
+
- - ">="
|
137
165
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0
|
139
|
-
description: A
|
140
|
-
email:
|
141
|
-
- contact@cyril.email
|
166
|
+
version: '0'
|
167
|
+
description: A minimalist RSpec clone with an emphasis on correctness and simplicity.
|
168
|
+
email: contact@cyril.email
|
142
169
|
executables: []
|
143
170
|
extensions: []
|
144
171
|
extra_rdoc_files: []
|
145
172
|
files:
|
146
|
-
- ".gitignore"
|
147
|
-
- ".rubocop.yml"
|
148
|
-
- ".rubocop_todo.yml"
|
149
|
-
- ".travis.yml"
|
150
|
-
- ".yardopts"
|
151
|
-
- CODE_OF_CONDUCT.md
|
152
|
-
- Gemfile
|
153
173
|
- LICENSE.md
|
154
174
|
- README.md
|
155
|
-
- Rakefile
|
156
|
-
- VERSION.semver
|
157
|
-
- bin/console
|
158
|
-
- bin/setup
|
159
|
-
- checksum/r_spec-0.1.0.gem.sha512
|
160
|
-
- checksum/r_spec-0.1.1.gem.sha512
|
161
|
-
- checksum/r_spec-0.2.0.gem.sha512
|
162
|
-
- checksum/r_spec-0.3.0.gem.sha512
|
163
|
-
- checksum/r_spec-0.3.1.gem.sha512
|
164
|
-
- checksum/r_spec-0.3.2.gem.sha512
|
165
|
-
- lib/fix/it.rb
|
166
|
-
- lib/fix/on.rb
|
167
175
|
- lib/r_spec.rb
|
168
|
-
-
|
169
|
-
- r_spec.
|
170
|
-
|
176
|
+
- lib/r_spec/dsl.rb
|
177
|
+
- lib/r_spec/exam.rb
|
178
|
+
- lib/r_spec/expect.rb
|
179
|
+
- lib/r_spec/pending.rb
|
180
|
+
- lib/r_spec/requirement.rb
|
181
|
+
- lib/r_spec/test.rb
|
182
|
+
homepage: https://r-spec.dev/
|
171
183
|
licenses:
|
172
184
|
- MIT
|
173
|
-
metadata:
|
185
|
+
metadata:
|
186
|
+
bug_tracker_uri: https://github.com/cyril/r_spec.rb/issues
|
187
|
+
documentation_uri: https://rubydoc.info/gems/r_spec
|
188
|
+
source_code_uri: https://github.com/cyril/r_spec.rb
|
174
189
|
post_install_message:
|
175
190
|
rdoc_options: []
|
176
191
|
require_paths:
|
@@ -179,15 +194,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
179
194
|
requirements:
|
180
195
|
- - ">="
|
181
196
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
197
|
+
version: 2.7.0
|
183
198
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
199
|
requirements:
|
185
|
-
- - "
|
200
|
+
- - ">"
|
186
201
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
202
|
+
version: 1.3.1
|
188
203
|
requirements: []
|
189
|
-
rubygems_version: 3.
|
204
|
+
rubygems_version: 3.1.6
|
190
205
|
signing_key:
|
191
206
|
specification_version: 4
|
192
|
-
summary:
|
207
|
+
summary: A minimalist RSpec clone
|
193
208
|
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-04-13 00:48:40 +0200 using RuboCop version 0.67.2.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: EnforcedStyle.
|
12
|
-
# SupportedStyles: when_needed, always, never
|
13
|
-
Style/FrozenStringLiteralComment:
|
14
|
-
Exclude:
|
15
|
-
- 'test/test_before.rb'
|
16
|
-
|
17
|
-
# Offense count: 9
|
18
|
-
Style/MixinUsage:
|
19
|
-
Exclude:
|
20
|
-
- 'test/test_before.rb'
|
21
|
-
- 'test/test_described_class.rb'
|
22
|
-
- 'test/test_embedded_context_blocks.rb'
|
23
|
-
- 'test/test_embedded_describe_blocks.rb'
|
24
|
-
- 'test/test_let.rb'
|
25
|
-
- 'test/test_something.rb'
|
26
|
-
- 'test/test_subject.rb'
|
27
|
-
- 'test/test_the_answer.rb'
|
28
|
-
- 'test/test_with_is_expected.rb'
|
data/.travis.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
script: 'bundle exec rake test:coverage --trace'
|
5
|
-
before_install:
|
6
|
-
- gem install bundler
|
7
|
-
rvm:
|
8
|
-
- 2.3.3
|
9
|
-
- 2.4.0
|
10
|
-
- 2.5.0
|
11
|
-
- 2.6.2
|
12
|
-
- ruby-head
|
13
|
-
- jruby-head
|
14
|
-
- rbx-3
|
15
|
-
matrix:
|
16
|
-
allow_failures:
|
17
|
-
- rvm: ruby-head
|
18
|
-
- rvm: jruby-head
|
19
|
-
- rvm: rbx-3
|
20
|
-
notifications:
|
21
|
-
webhooks:
|
22
|
-
urls:
|
23
|
-
- https://webhooks.gitter.im/e/a44b19cc5cf6db25fa87
|
24
|
-
on_success: change
|
25
|
-
on_failure: always
|
26
|
-
on_start: never
|
data/.yardopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
- README.md
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
-
|
5
|
-
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
-
|
7
|
-
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
-
|
9
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
-
|
11
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
-
|
13
|
-
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.0.0, available at [https://www.contributor-covenant.org/version/1/0/0/code-of-conduct.html](https://www.contributor-covenant.org/version/1/0/0/code-of-conduct.html)
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'rubocop/rake_task'
|
6
|
-
|
7
|
-
RuboCop::RakeTask.new
|
8
|
-
|
9
|
-
Rake::TestTask.new do |t|
|
10
|
-
t.verbose = true
|
11
|
-
t.warning = true
|
12
|
-
end
|
13
|
-
|
14
|
-
namespace :test do
|
15
|
-
task :coverage do
|
16
|
-
ENV['COVERAGE'] = 'true'
|
17
|
-
Rake::Task['test'].invoke
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
task(:doc_stats) { ruby '-S yard stats' }
|
22
|
-
task default: %i[test doc_stats rubocop]
|
data/VERSION.semver
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.3
|
data/bin/console
DELETED
data/bin/setup
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2988d048456c0dcc53bd2c8c45d8fd0f7de49e1f2bb0a3aca0749671b4baa4376e44e25d05f9ee457fe024872155ce93c8fe5c5e03fdcd494962d69805c5fce3
|
@@ -1 +0,0 @@
|
|
1
|
-
541eb96ff91798d807dc5b0bd71dab3e5c17358bc0e5bca8784607b8de0c8e9532011e958e152fb4a22bc653d9af13bd5edaf0989ff77c7941004f03ad0f29be
|
@@ -1 +0,0 @@
|
|
1
|
-
9c58b303e8a3c03de72abb0ee0083cf4a83e71d3c3d783fc2d70c51e6e3a49cc281881da78a9ff326cf5462eace11bdb5acb5826228896e6b91abd437d859b17
|
@@ -1 +0,0 @@
|
|
1
|
-
ad3c4000dcc528f6ddc033df570f41f031917894140b91722adab3d11af6bd818f7e94f6709b5bd4e9c0d4e4114f7639f9f386c8d39c113bd832a7bd866a54cd
|
@@ -1 +0,0 @@
|
|
1
|
-
a84d0332166216081a39df15433e87daf2295c376a7e58c17bc3d36bc6aca82c0658b29b2de50e9c71196fd158854205c30123217225af713764a3db65e82a70
|
@@ -1 +0,0 @@
|
|
1
|
-
f777e4bdccb8e62313f1e04a0012f952e55aae439f170549f9ef18b05e0e3b54831c045662603e98c8976c5b4ede20c3d47d75a1d17d02503ae9ce1bf55b9651
|
data/lib/fix/it.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Namespace for the Fix framework.
|
4
|
-
module Fix
|
5
|
-
# Override Fix's It class.
|
6
|
-
class It
|
7
|
-
# @return [Class] The class of the described object.
|
8
|
-
def described_class
|
9
|
-
subject.is_a?(::Class) ? subject : subject.class
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/lib/fix/on.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Namespace for the Fix framework.
|
4
|
-
module Fix
|
5
|
-
# Override Fix's On class.
|
6
|
-
class On
|
7
|
-
# Useful to perform side-effects, e.g., add something in to a database.
|
8
|
-
#
|
9
|
-
# @note To declare an instance variable, use the `let` helper instead.
|
10
|
-
#
|
11
|
-
# @param block [Proc] The block to call.
|
12
|
-
#
|
13
|
-
# @return [#object_id] The given block.
|
14
|
-
def before(*)
|
15
|
-
yield
|
16
|
-
end
|
17
|
-
|
18
|
-
# @param another_front_object [#object_id] Override the front object.
|
19
|
-
# @param specs [Proc] A set of specs.
|
20
|
-
#
|
21
|
-
# @return [Array] List of results.
|
22
|
-
def describe(another_front_object, *, &specs)
|
23
|
-
o = On.new(another_front_object,
|
24
|
-
results,
|
25
|
-
challenges,
|
26
|
-
helpers.dup,
|
27
|
-
configuration)
|
28
|
-
|
29
|
-
o.instance_eval(&specs)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Override the implicit subject.
|
33
|
-
#
|
34
|
-
# @param block [Proc, nil] Another subject inside a block.
|
35
|
-
#
|
36
|
-
# @return [#object_id] The subject.
|
37
|
-
def subject(&block)
|
38
|
-
if block_given?
|
39
|
-
@described = yield
|
40
|
-
else
|
41
|
-
super
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/pkg_checksum
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'digest/sha2'
|
5
|
-
|
6
|
-
gemname = 'r_spec'.to_sym
|
7
|
-
ARGV[0] = File.read('VERSION.semver').chomp if ARGV[0].nil?
|
8
|
-
built_gem_path = "pkg/#{gemname}-#{ARGV[0]}.gem"
|
9
|
-
checksum = Digest::SHA512.new.hexdigest(File.read(built_gem_path))
|
10
|
-
checksum_path = "checksum/#{gemname}-#{ARGV[0]}.gem.sha512"
|
11
|
-
|
12
|
-
File.open(checksum_path, 'w') { |f| f.write("#{checksum}\n") }
|
data/r_spec.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'r_spec'
|
5
|
-
spec.version = File.read('VERSION.semver').chomp
|
6
|
-
spec.authors = ['Cyril Kato']
|
7
|
-
spec.email = ['contact@cyril.email']
|
8
|
-
|
9
|
-
spec.summary = 'Rspec clone with Fix.'
|
10
|
-
spec.description = 'A small Rspec clone based on Fix specing framework.'
|
11
|
-
spec.homepage = 'https://github.com/cyril/r_spec'
|
12
|
-
spec.license = 'MIT'
|
13
|
-
|
14
|
-
spec.files =
|
15
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^test/}) }
|
16
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
|
-
spec.require_paths = ['lib']
|
18
|
-
|
19
|
-
spec.add_dependency 'fix-expect', '~> 0.3.5'
|
20
|
-
spec.add_dependency 'fix-its', '~> 0.5.4'
|
21
|
-
spec.add_dependency 'matchi-rspec', '~> 0.1.3'
|
22
|
-
|
23
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
24
|
-
spec.add_development_dependency 'rake', '~> 12.3'
|
25
|
-
spec.add_development_dependency 'rubocop', '~> 0.70'
|
26
|
-
spec.add_development_dependency 'simplecov', '~> 0.16'
|
27
|
-
spec.add_development_dependency 'spectus', '~> 3.0'
|
28
|
-
spec.add_development_dependency 'yard', '~> 0.9'
|
29
|
-
end
|