r_spec 1.0.0.beta2 → 1.0.0.beta7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ module RSpec
6
+ module ExpectationTarget
7
+ # Wraps the target of an expectation with a value.
8
+ #
9
+ # @example
10
+ # expect(something) # => ExpectationTarget::Value wrapping something
11
+ #
12
+ # # used with `to`
13
+ # expect(actual).to be(42)
14
+ #
15
+ # # with `not_to`
16
+ # expect(actual).not_to be(4)
17
+ #
18
+ # @note `RSpec::ExpectationTarget::Value` is not intended to be instantiated
19
+ # directly by users. Use `expect` instead.
20
+ class Value < Base
21
+ protected
22
+
23
+ # @param matcher [#matches?] The matcher.
24
+ # @param negate [Boolean] The assertion is positive or negative.
25
+ #
26
+ # @return [nil] Write a message to STDOUT.
27
+ #
28
+ # @raise [SystemExit] Terminate execution immediately by calling
29
+ # `Kernel.exit(false)` with a failure message written to STDERR.
30
+ def absolute_requirement(matcher:, negate:)
31
+ valid = negate ^ matcher.matches? { @actual }
32
+
33
+ result(
34
+ actual: @actual,
35
+ error: nil,
36
+ got: valid,
37
+ matcher: matcher,
38
+ negate: negate,
39
+ valid: valid
40
+ )
41
+ end
42
+ end
43
+ end
44
+ 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.beta2
4
+ version: 1.0.0.beta7
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-04 00:00:00.000000000 Z
11
+ date: 2021-06-16 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.2
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.2
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.4
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.4
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,11 +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
192
+ - lib/r_spec/error.rb
193
+ - lib/r_spec/error/pending_expectation.rb
194
+ - lib/r_spec/error/reserved_method.rb
195
+ - lib/r_spec/error/undefined_described_class.rb
196
+ - lib/r_spec/error/undefined_subject.rb
197
+ - lib/r_spec/expectation_helper.rb
198
+ - lib/r_spec/expectation_helper/it.rb
199
+ - lib/r_spec/expectation_helper/its.rb
200
+ - lib/r_spec/expectation_helper/shared.rb
177
201
  - lib/r_spec/expectation_target.rb
178
- - lib/r_spec/log.rb
179
- - lib/r_spec/pending.rb
180
- - lib/r_spec/test.rb
202
+ - lib/r_spec/expectation_target/base.rb
203
+ - lib/r_spec/expectation_target/block.rb
204
+ - lib/r_spec/expectation_target/value.rb
181
205
  homepage: https://r-spec.dev/
182
206
  licenses:
183
207
  - MIT
@@ -185,6 +209,7 @@ metadata:
185
209
  bug_tracker_uri: https://github.com/cyril/r_spec.rb/issues
186
210
  documentation_uri: https://rubydoc.info/gems/r_spec
187
211
  source_code_uri: https://github.com/cyril/r_spec.rb
212
+ wiki_uri: https://github.com/cyril/r_spec.rb/wiki
188
213
  post_install_message:
189
214
  rdoc_options: []
190
215
  require_paths:
data/lib/r_spec/log.rb DELETED
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "expresenter"
4
-
5
- module RSpec
6
- # Exception for debugging purpose.
7
- class Log < ::NoMethodError
8
- # @param message [String] A message to log to the console.
9
- #
10
- # @return [nil] Write a log message to STDOUT.
11
- def self.result(message)
12
- puts " " + ::Expresenter.call(true).with(
13
- actual: nil,
14
- error: new(message),
15
- expected: 42,
16
- got: nil,
17
- matcher: :be,
18
- negate: false,
19
- level: :MAY,
20
- valid: false
21
- ).colored_string
22
- end
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "expresenter"
4
-
5
- module RSpec
6
- # Exception for pending expectations.
7
- class Pending < ::NotImplementedError
8
- # @param message [String] The not implemented expectation description.
9
- #
10
- # @return [nil] Write a pending expectation to STDOUT.
11
- def self.result(message)
12
- warn " " + ::Expresenter.call(true).with(
13
- actual: new(message),
14
- error: nil,
15
- expected: self,
16
- got: false,
17
- matcher: :raise_exception,
18
- negate: true,
19
- level: :SHOULD,
20
- valid: false
21
- ).colored_string
22
- end
23
- end
24
- end
data/lib/r_spec/test.rb DELETED
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RSpec
4
- # Namespace to collect test classes.
5
- module Test
6
- end
7
- end