doc_rspec 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46bc118ccd32d52dd764381cf3d8c6273c31c448199fbd6776e78f4ece0b8504
4
- data.tar.gz: 606e445893abbc97ad32e506ce45ce23d49554a19d7e5342de84630ebd99467f
3
+ metadata.gz: b3ea3a68b2a618eeac53b5988fcf7bef4c767b43899fa158ea5171af5e2b9866
4
+ data.tar.gz: a95753a22dd8b00590b733b9774823a722b883dff39b7e79f60a018386278905
5
5
  SHA512:
6
- metadata.gz: 8082a05554da0613a0e6566f8bbc60c515652037b95c1d273dd09a8955dfb625b7471af38a91a759bbc685c9bc0be136916deb4735bbb0e4231bcd987ac36378
7
- data.tar.gz: 877dda2bc5bd01c8acaf40a9ed521b3a2d72ba23a98e428e963b887c65a70119d26437fd4415686e82430f899af81662df5cc3275c6290bb1084fc79130166c7
6
+ metadata.gz: 15dfea09b23cf93667f6b7b2845a60b98e8346ae64b539040e4d17c4562c000035dc391e70258e2d39847e4f591c08cd724dcedd3b053aee38d49d6b37f9cb1d
7
+ data.tar.gz: 51d041f6637b3aa8069511f08ff014fbf610e07c6678604c7e4b5324e6c63daf5d5161a5ffe54b00a1b9391c0123cb958df7cb61c320674f61cc3b0b3eb272e0
@@ -15,6 +15,7 @@ class DocRSpec
15
15
  SHORT_EQUALS = %r{\s \=\=\> \s}x
16
16
  SHORT_MATCHES = %r{\s \~\> \s}x
17
17
  SHORT_PREDICATE = %r{\s is\! \s}x
18
+ SHORT_ANTIPREDICATE = %r{\s not\! \s}x
18
19
  START_EXAMPLE = %r{\A \s* \# \s{4,} \# \s example: \s (.*)}x
19
20
 
20
21
  attr_reader :ast, :lines, :state
@@ -64,7 +65,12 @@ class DocRSpec
64
65
  in [lhs, rhs]
65
66
  ast.last.add_example_line("expect(#{lhs}).to be_#{rhs}")
66
67
  else
67
- ast.last.add_example_line(code)
68
+ case code.split(SHORT_ANTIPREDICATE)
69
+ in [lhs, rhs]
70
+ ast.last.add_example_line("expect(#{lhs}).not_to be_#{rhs}")
71
+ else
72
+ ast.last.add_example_line(code)
73
+ end
68
74
  end
69
75
  end
70
76
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class DocRSpec
4
4
  module Version
5
- VERSION = '0.2.2'
5
+ VERSION = '0.2.3'
6
6
  end
7
7
  end
8
8
  # SPDX-License-Identifier: AGPL-3.0-or-later
data/lib/doc_rspec.rb CHANGED
@@ -85,6 +85,13 @@ RSpec.configure { it.extend DocRSpec::RSpecExampleGroup }
85
85
  # require 'ostruct'
86
86
  # OpenStruct.new(ok?: true) is! ok
87
87
  #
88
+ # === +not!+ for not be_
89
+ #
90
+ # # example: is! shorthand for be
91
+ #
92
+ # require 'ostruct'
93
+ # OpenStruct.new(ok?: false) not! ok
94
+ #
88
95
  class DocRSpec
89
96
 
90
97
  attr_reader :example_group, :lines, :path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doc_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober