r_spec 1.0.0.beta1 → 1.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RSpec
4
+ # Namespace to collect test classes.
5
+ #
6
+ # @api private
7
+ module Sandbox
8
+ end
9
+ end
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.0.beta1
4
+ version: 1.0.0.beta6
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-05-30 00:00:00.000000000 Z
11
+ date: 2021-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expresenter
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0
19
+ version: 1.2.1
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: 1.2.0
26
+ version: 1.2.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: matchi-rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.0
33
+ version: 1.1.1
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: 1.1.0
40
+ version: 1.1.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: spectus
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.3.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.3.3
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +178,7 @@ dependencies:
164
178
  - - ">="
165
179
  - !ruby/object:Gem::Version
166
180
  version: '0'
167
- description: A minimalist RSpec clone with an emphasis on correctness and simplicity.
181
+ description: A minimalist RSpec clone with all the essentials.
168
182
  email: contact@cyril.email
169
183
  executables: []
170
184
  extensions: []
@@ -173,12 +187,21 @@ files:
173
187
  - LICENSE.md
174
188
  - README.md
175
189
  - lib/r_spec.rb
190
+ - lib/r_spec/console.rb
176
191
  - 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
192
+ - lib/r_spec/error.rb
193
+ - lib/r_spec/error/pending_expectation.rb
194
+ - lib/r_spec/error/undefined_described_class.rb
195
+ - lib/r_spec/error/undefined_subject.rb
196
+ - lib/r_spec/expectation_helper.rb
197
+ - lib/r_spec/expectation_helper/base.rb
198
+ - lib/r_spec/expectation_helper/it.rb
199
+ - lib/r_spec/expectation_helper/its.rb
200
+ - lib/r_spec/expectation_target.rb
201
+ - lib/r_spec/expectation_target/base.rb
202
+ - lib/r_spec/expectation_target/block.rb
203
+ - lib/r_spec/expectation_target/value.rb
204
+ - lib/r_spec/sandbox.rb
182
205
  homepage: https://r-spec.dev/
183
206
  licenses:
184
207
  - MIT
@@ -186,6 +209,7 @@ metadata:
186
209
  bug_tracker_uri: https://github.com/cyril/r_spec.rb/issues
187
210
  documentation_uri: https://rubydoc.info/gems/r_spec
188
211
  source_code_uri: https://github.com/cyril/r_spec.rb
212
+ wiki_uri: https://github.com/cyril/r_spec.rb/wiki
189
213
  post_install_message:
190
214
  rdoc_options: []
191
215
  require_paths:
data/lib/r_spec/exam.rb DELETED
@@ -1,29 +0,0 @@
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
data/lib/r_spec/expect.rb DELETED
@@ -1,19 +0,0 @@
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"
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RSpec
4
- # rubocop:disable Lint/InheritException
5
- class Pending < ::NotImplementedError
6
- end
7
- # rubocop:enable Lint/InheritException
8
- end
@@ -1,90 +0,0 @@
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 DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RSpec
4
- # Set of tests.
5
- #
6
- # rubocop:disable Lint/EmptyClass
7
- class Test
8
- end
9
- # rubocop:enable Lint/EmptyClass
10
- end