is-rspec 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +46 -0
- data/is-rspec.gemspec +9 -0
- data/lib/is/rspec.rb +38 -0
- data/readme.adoc +15 -0
- data/spec/is_spec.rb +27 -0
- metadata +61 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: eceb0ae7c6dcd5e2cbb33a936c4f2d3883adc86da397b372049e3c00228a128d
|
4
|
+
data.tar.gz: 5befd423ac89848f6106251a93ec5f7379021302e60621ff67ba4fb687f9730d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2b325be7ff812257da7a9b00a6d765afa75c8e616273cb58b91a0f936e6b2d878439bed67b7b2dee3c3803ab2f95fb2c9811d4cf24e1f3300869c673beb5706
|
7
|
+
data.tar.gz: 0cec8922cc687782753be0433fb0327a1e727f2157d2055a1b47000996c211038d256c18fc33343aa6c6971a3ed881fd1b748eed25f20b158f93ba4c5d14cf51
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
is-rspec (0.0.0)
|
5
|
+
rspec
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
awesome_print (1.8.0)
|
11
|
+
byebug (11.0.1)
|
12
|
+
coderay (1.1.2)
|
13
|
+
diff-lcs (1.3)
|
14
|
+
method_source (0.9.2)
|
15
|
+
pry (0.12.2)
|
16
|
+
coderay (~> 1.1.0)
|
17
|
+
method_source (~> 0.9.0)
|
18
|
+
pry-byebug (3.7.0)
|
19
|
+
byebug (~> 11.0)
|
20
|
+
pry (~> 0.10)
|
21
|
+
rspec (3.9.0)
|
22
|
+
rspec-core (~> 3.9.0)
|
23
|
+
rspec-expectations (~> 3.9.0)
|
24
|
+
rspec-mocks (~> 3.9.0)
|
25
|
+
rspec-core (3.9.0)
|
26
|
+
rspec-support (~> 3.9.0)
|
27
|
+
rspec-expectations (3.9.0)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.9.0)
|
30
|
+
rspec-mocks (3.9.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.9.0)
|
33
|
+
rspec-support (3.9.0)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
ruby
|
37
|
+
|
38
|
+
DEPENDENCIES
|
39
|
+
awesome_print
|
40
|
+
byebug
|
41
|
+
is-rspec!
|
42
|
+
pry
|
43
|
+
pry-byebug
|
44
|
+
|
45
|
+
BUNDLED WITH
|
46
|
+
1.17.2
|
data/is-rspec.gemspec
ADDED
data/lib/is/rspec.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
module Is
|
4
|
+
module RSpec
|
5
|
+
class Matcher
|
6
|
+
def initialize type
|
7
|
+
@type = type
|
8
|
+
end
|
9
|
+
|
10
|
+
def matches? it
|
11
|
+
@instance = @type.new it
|
12
|
+
@instance.ok?
|
13
|
+
end
|
14
|
+
|
15
|
+
def failure_message
|
16
|
+
@instance.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def description
|
20
|
+
"be of #{@type}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Helpers
|
25
|
+
def fit type
|
26
|
+
Matcher.new type
|
27
|
+
end
|
28
|
+
|
29
|
+
def is it, type
|
30
|
+
expect(it).to fit type
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec.configure do |config|
|
37
|
+
config.include Is::RSpec::Helpers
|
38
|
+
end
|
data/readme.adoc
ADDED
data/spec/is_spec.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'is/rspec'
|
2
|
+
|
3
|
+
class T
|
4
|
+
def initialize it
|
5
|
+
@it = it
|
6
|
+
end
|
7
|
+
|
8
|
+
def ok?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
"got #{@it}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe do
|
18
|
+
it do
|
19
|
+
matcher = fit T
|
20
|
+
|
21
|
+
bool = matcher.matches? 42
|
22
|
+
expect(bool).to be false
|
23
|
+
|
24
|
+
expect(matcher.failure_message).to eq "got 42"
|
25
|
+
expect(matcher.description).to eq "be of T"
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: is-rspec
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anatoly Chernow
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- Gemfile
|
34
|
+
- Gemfile.lock
|
35
|
+
- is-rspec.gemspec
|
36
|
+
- lib/is/rspec.rb
|
37
|
+
- readme.adoc
|
38
|
+
- spec/is_spec.rb
|
39
|
+
homepage:
|
40
|
+
licenses: []
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubygems_version: 3.0.3
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: A RSpec matcher for typed testing.
|
61
|
+
test_files: []
|