typ-rspec-matcher 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 422917805d1539364b74f60b45d6e180738848fd4eccc0f168decca53fc0ead7
4
+ data.tar.gz: cc94c089b1ec3a097482d89491b6ca28978f3dc21f3dcf91b0daa4b8b35a898b
5
+ SHA512:
6
+ metadata.gz: 56bdefb7d1ac49c0a4ddb13fd4aa14c8de617b0ac2dff6cf5edc005eab713dfe079c0f156cc2c653b3b0cf0cc58e493773852357999115851424846588c3ba36
7
+ data.tar.gz: 5de9b2cfa1a0841d541eca97761f0d19db4a0cd5fd2a50944b1fa1d6f888eabe22138b4ffd486111b2558aba332eabe4352ad09fe093a2b8db7b48a8a0aae7fd
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'pry'
4
+ gem 'awesome_print'
5
+ gem 'byebug'
6
+ gem 'pry-byebug'
7
+ gem 'mutant'
8
+ gem 'mutant-rspec'
9
+ gem 'rspec'
10
+ gem 'typ'
11
+
12
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,115 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ typ-rspec-matcer (0.0.0)
5
+ awesome_print
6
+ typ-formatter
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ abstract_type (0.0.7)
12
+ adamantium (0.2.0)
13
+ ice_nine (~> 0.11.0)
14
+ memoizable (~> 0.4.0)
15
+ anima (0.3.0)
16
+ abstract_type (~> 0.0.7)
17
+ adamantium (~> 0.2)
18
+ equalizer (~> 0.0.11)
19
+ ast (2.4.0)
20
+ awesome_print (1.8.0)
21
+ byebug (10.0.2)
22
+ coderay (1.1.2)
23
+ concord (0.1.5)
24
+ adamantium (~> 0.2.0)
25
+ equalizer (~> 0.0.9)
26
+ diff-lcs (1.3)
27
+ equalizer (0.0.11)
28
+ ice_nine (0.11.2)
29
+ memoizable (0.4.2)
30
+ thread_safe (~> 0.3, >= 0.3.1)
31
+ method_source (0.9.0)
32
+ morpher (0.2.6)
33
+ abstract_type (~> 0.0.7)
34
+ adamantium (~> 0.2.0)
35
+ anima (~> 0.3.0)
36
+ ast (~> 2.2)
37
+ concord (~> 0.1.5)
38
+ equalizer (~> 0.0.9)
39
+ ice_nine (~> 0.11.0)
40
+ procto (~> 0.0.2)
41
+ mutant (0.8.14)
42
+ abstract_type (~> 0.0.7)
43
+ adamantium (~> 0.2.0)
44
+ anima (~> 0.3.0)
45
+ ast (~> 2.2)
46
+ concord (~> 0.1.5)
47
+ diff-lcs (~> 1.3)
48
+ equalizer (~> 0.0.9)
49
+ ice_nine (~> 0.11.1)
50
+ memoizable (~> 0.4.2)
51
+ morpher (~> 0.2.6)
52
+ parallel (~> 1.3)
53
+ parser (>= 2.3.1.4, < 2.5)
54
+ procto (~> 0.0.2)
55
+ regexp_parser (~> 0.4.3)
56
+ unparser (~> 0.2.5)
57
+ mutant-rspec (0.8.14)
58
+ mutant (~> 0.8.14)
59
+ rspec-core (>= 3.4.0, < 3.7.0)
60
+ parallel (1.12.1)
61
+ parser (2.4.0.2)
62
+ ast (~> 2.3)
63
+ procto (0.0.3)
64
+ pry (0.11.3)
65
+ coderay (~> 1.1.0)
66
+ method_source (~> 0.9.0)
67
+ pry-byebug (3.6.0)
68
+ byebug (~> 10.0)
69
+ pry (~> 0.10)
70
+ rainbow (3.0.0)
71
+ regexp_parser (0.4.13)
72
+ rspec (3.6.0)
73
+ rspec-core (~> 3.6.0)
74
+ rspec-expectations (~> 3.6.0)
75
+ rspec-mocks (~> 3.6.0)
76
+ rspec-core (3.6.0)
77
+ rspec-support (~> 3.6.0)
78
+ rspec-expectations (3.6.0)
79
+ diff-lcs (>= 1.2.0, < 2.0)
80
+ rspec-support (~> 3.6.0)
81
+ rspec-mocks (3.6.0)
82
+ diff-lcs (>= 1.2.0, < 2.0)
83
+ rspec-support (~> 3.6.0)
84
+ rspec-support (3.6.0)
85
+ string-indent (0.0.1)
86
+ thread_safe (0.3.6)
87
+ typ (0.0.3)
88
+ typ-formatter (0.0.1)
89
+ rainbow
90
+ string-indent
91
+ unparser (0.2.7)
92
+ abstract_type (~> 0.0.7)
93
+ adamantium (~> 0.2.0)
94
+ concord (~> 0.1.5)
95
+ diff-lcs (~> 1.3)
96
+ equalizer (~> 0.0.9)
97
+ parser (>= 2.3.1.2, < 2.6)
98
+ procto (~> 0.0.2)
99
+
100
+ PLATFORMS
101
+ ruby
102
+
103
+ DEPENDENCIES
104
+ awesome_print
105
+ byebug
106
+ mutant
107
+ mutant-rspec
108
+ pry
109
+ pry-byebug
110
+ rspec
111
+ typ
112
+ typ-rspec-matcer!
113
+
114
+ BUNDLED WITH
115
+ 1.16.1
@@ -0,0 +1,5 @@
1
+ require_relative '../matcher'
2
+
3
+ def typ typ_class
4
+ Typ::RSpec::Matcher.new typ_class
5
+ end
@@ -0,0 +1,22 @@
1
+ require 'ap'
2
+ require 'typ/formatter'
3
+
4
+ module Typ
5
+ module RSpec
6
+ class Matcher
7
+ def initialize typ_class
8
+ @typ_class = typ_class
9
+ end
10
+
11
+ def match? it
12
+ @it = it
13
+ @typ = @typ_class.new it
14
+ @typ.ok?
15
+ end
16
+
17
+ def failure_message
18
+ @it.ai + "\n" + Formatter.new(@typ).to_s
19
+ end
20
+ end
21
+ end
22
+ end
data/readme.adoc ADDED
@@ -0,0 +1,22 @@
1
+ == Development
2
+
3
+ To build:
4
+
5
+ [source,bash]
6
+ ----
7
+ bundle exec bgem
8
+ ----
9
+
10
+ To run the specs:
11
+
12
+ [source,bash]
13
+ ----
14
+ bundle exec rspec
15
+ ----
16
+
17
+ To perform mutation analysis:
18
+
19
+ [source,bash]
20
+ ----
21
+ bundle exec mutant --use rspec 'Typ::RSpec::Matcher*'
22
+ ----
@@ -0,0 +1,23 @@
1
+ require_relative 'helper'
2
+
3
+ class Positive
4
+ include Typ
5
+ is [:>, 0]
6
+ end
7
+
8
+ describe Typ::RSpec::Matcher do
9
+ let(:matcher) { described_class.new Positive }
10
+
11
+ it 'works' do
12
+ bool = matcher.match? -1
13
+ expect(bool).to be false
14
+
15
+ failure_message = <<~S.chomp
16
+ -1
17
+ #{Rainbow(Positive).red}
18
+ #{Rainbow('is [:>, 0]').red}
19
+ S
20
+
21
+ expect(matcher.failure_message).to eq failure_message
22
+ end
23
+ end
data/spec/helper.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'typ'
2
+ require 'typ/rspec/matcher'
@@ -0,0 +1,10 @@
1
+ Gem::Specification.new do |g|
2
+ g.name = 'typ-rspec-matcher'
3
+ g.files = `git ls-files`.split($/)
4
+ g.version = '0.0.0'
5
+ g.summary = 'A RSpec matcher to check objects with typs.'
6
+ g.authors = ['Anatoly Chernow']
7
+
8
+ g.add_dependency 'awesome_print'
9
+ g.add_dependency 'typ-formatter'
10
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: typ-rspec-matcher
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: 2018-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: awesome_print
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
+ - !ruby/object:Gem::Dependency
28
+ name: typ-formatter
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email:
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - Gemfile
48
+ - Gemfile.lock
49
+ - lib/typ/rspec/matcher.rb
50
+ - lib/typ/rspec/matcher/with_method.rb
51
+ - readme.adoc
52
+ - spec/Matcher_spec.rb
53
+ - spec/helper.rb
54
+ - typ-rspec-matcher.gemspec
55
+ homepage:
56
+ licenses: []
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.7.6
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: A RSpec matcher to check objects with typs.
78
+ test_files: []