typ-rspec-matcher 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb08fefcf8b6ccb92cdcefc43f7dd7fb7a7506d053116952be41805440b063c8
4
- data.tar.gz: bd4a2573ee72e6175ce0cca7a4ff322be2cf6bbd2093580e28e1cf7fd251a68c
3
+ metadata.gz: f6085c7421c3435ff46e09b6d960233bb69134963aa7b050dbc1d7af6fdcbd48
4
+ data.tar.gz: 2c7bd1be40cf6248ade08de93d580e264229191ef33e89e3a8c8d9edb3740e68
5
5
  SHA512:
6
- metadata.gz: 4c91b5cc43fdefdf1cd1e395adb78f95157c518b88570c2fe8be9ca5ee8b18d8c8cb96510d328d25d6a529b07db3b3ad747c7423e7d4876346bbabbc041da127
7
- data.tar.gz: ed1ea109d3e0dae3198a55c6df3dca9c3d901cc0a754da10478846fb19f63bc8f5f685ba07da4b5703117581fb53de5ffaea4220670d1ce590c8bf5f902f2485
6
+ metadata.gz: c21501704a30cbe6ecb1482df09e01c41b601af0775847fd4ff59bf14695a2ae2505301ff3db671a7e0b6854433193cbb674b2d8b190ad90d41d6ca0450f7242
7
+ data.tar.gz: 0fb026184f2def3cf4fe1f69211d58e11edc192dc309385ae8023fe27070550518aa5a1ae72b29b4d9d76b6e4da656bd56bd4969cf135bba02a3a5ef899b7c65
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- typ-rspec-matcher (0.1.0)
5
- awesome_print
6
- typ
7
- typ-formatter
4
+ typ-rspec-matcher (0.1.2)
5
+ awesome_print (~> 1.9.2)
6
+ typ (~> 0.1.2)
7
+ typ-formatter (~> 0.1.2)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
@@ -31,10 +31,12 @@ GEM
31
31
  rspec-support (~> 3.12.0)
32
32
  rspec-support (3.12.1)
33
33
  string-indent (0.0.1)
34
- typ (0.0.6)
35
- typ-formatter (0.0.2)
36
- rainbow
37
- string-indent
34
+ typ (0.1.2)
35
+ typ-formatter (0.1.2)
36
+ awesome_print (~> 1.9.2)
37
+ rainbow (~> 3.1.1)
38
+ string-indent (~> 0.0.1)
39
+ typ (>= 0.1.2)
38
40
 
39
41
  PLATFORMS
40
42
  x86_64-linux
@@ -1,5 +1,15 @@
1
+ require 'typ'
1
2
  require_relative '../matcher'
2
3
 
3
- def pose typ_class
4
- Typ::RSpec::Matcher.new typ_class
4
+ def pose typ_class = nil, &block
5
+ typ_class ||= Class.new do
6
+ include Typ
7
+ end
8
+
9
+ if block_given?
10
+ typ_class.instance_exec &block
11
+ Typ::RSpec::Matcher.new typ_class, ' pose'
12
+ else
13
+ Typ::RSpec::Matcher.new typ_class
14
+ end
5
15
  end
@@ -4,13 +4,14 @@ require 'typ/formatter'
4
4
  module Typ
5
5
  module RSpec
6
6
  class Matcher
7
- def initialize typ_class
8
- @typ_class = typ_class
7
+ def initialize typ_class, name_appendix = nil
8
+ @typ_class, @name_appendix = typ_class, name_appendix
9
9
  end
10
10
 
11
11
  def matches? it
12
12
  @it = it
13
13
  @typ = @typ_class.new it
14
+ @typ.name += @name_appendix if @name_appendix
14
15
  @typ.ok?
15
16
  end
16
17
 
data/spec/Matcher_spec.rb CHANGED
@@ -1,10 +1,5 @@
1
1
  require_relative 'helper'
2
2
 
3
- class Positive
4
- include Typ
5
- is [:>, 0]
6
- end
7
-
8
3
  describe Typ::RSpec::Matcher do
9
4
  let(:matcher) { described_class.new Positive }
10
5
 
data/spec/helper.rb CHANGED
@@ -1,2 +1,7 @@
1
1
  require 'typ'
2
2
  require 'typ/rspec/matcher'
3
+
4
+ class Positive
5
+ include Typ
6
+ is [:>, 0]
7
+ end
data/spec/pose_spec.rb ADDED
@@ -0,0 +1,20 @@
1
+ require_relative 'helper'
2
+ require 'typ/rspec/matcher/pose'
3
+
4
+ describe 'pose' do
5
+ it 'works without a block' do
6
+ c = Class.new do
7
+ include Typ
8
+ is [:>, 0]
9
+ end
10
+
11
+ expect(1).to pose c
12
+ expect(1).to pose Positive
13
+ end
14
+
15
+ it 'works with a block' do
16
+ expect(1).to pose {
17
+ is [:>, 0]
18
+ }
19
+ end
20
+ end
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |g|
2
2
  g.name = 'typ-rspec-matcher'
3
3
  g.files = `git ls-files`.split($/)
4
- g.version = '0.1.0'
5
- g.summary = 'A RSpec matcher to check objects with typs.'
4
+ g.version = '0.1.2'
5
+ g.summary = 'A RSpec matcher to pose.'
6
6
  g.authors = ['Anatoly Chernov']
7
- g.email = ["chertoly@gmail.com"]
7
+ g.email = ['chertoly@gmail.com']
8
8
 
9
- g.add_dependency 'awesome_print'
10
- g.add_dependency 'typ-formatter'
11
- g.add_dependency 'typ'
9
+ g.add_dependency 'awesome_print', '~> 1.9.2'
10
+ g.add_dependency 'typ-formatter', '~> 0.1.2'
11
+ g.add_dependency 'typ', '~> 0.1.2'
12
12
  end
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typ-rspec-matcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anatoly Chernov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-25 00:00:00.000000000 Z
11
+ date: 2023-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 1.9.2
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: '0'
26
+ version: 1.9.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: typ-formatter
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.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: '0'
40
+ version: 0.1.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: typ
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.1.2
48
48
  type: :runtime
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.1.2
55
55
  description:
56
56
  email:
57
57
  - chertoly@gmail.com
@@ -66,6 +66,7 @@ files:
66
66
  - readme.adoc
67
67
  - spec/Matcher_spec.rb
68
68
  - spec/helper.rb
69
+ - spec/pose_spec.rb
69
70
  - typ-rspec-matcher.gemspec
70
71
  homepage:
71
72
  licenses: []
@@ -88,5 +89,5 @@ requirements: []
88
89
  rubygems_version: 3.4.15
89
90
  signing_key:
90
91
  specification_version: 4
91
- summary: A RSpec matcher to check objects with typs.
92
+ summary: A RSpec matcher to pose.
92
93
  test_files: []