glimmer-dsl-specification 0.0.4 → 0.0.5

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: b90c13783d40d051398b8cbdd70b567125424df2a62a15aa3405786f0cb6da48
4
- data.tar.gz: c10821dfd0ace2d29390be14206f5ef6c502d714c90924d12cb46d7584e15da5
3
+ metadata.gz: c568e6f0d20ba4aa1684c7c33904fe7bc6e69a7435aba1c74e02218b2d0b21ee
4
+ data.tar.gz: 3b40f8f4bbe4cb91eb5b074eed08d7e7449b8ac742592bfc594eb6771bb60b5e
5
5
  SHA512:
6
- metadata.gz: d44d6a7dc1e17e9f78f346d7050182d97148ce2ffe21d9f941aa9d8320c89e1da57436b0396fc0acdf5fed9e9da147ff3926f0b7dc9af442c1eb69c4e75a5fcb
7
- data.tar.gz: 29723cf049ee41fb5b2cf383fbadbb187a5103ecec3ddbfa97d0e68553d5bbd5de8503e6d602f07a7b1fc80f82739dcbdfc289b1c610e6e783c385b210d3a532
6
+ metadata.gz: 8892bc418e5d49c843c044d3640e1020bb6140b0883895cec055cb66d6ccbea30a6a6535c0172f67898e884793868c6430a5c9451975c359701f40bf7c28fd99
7
+ data.tar.gz: 18066d69a02d797c05e3b96d0f6f14e422bb0047bffdf86d2b89e5eebbb36b16a8c925f3fc577cf24eb54b072f58600a44fefa989f99e366e357f4ebfe0a5b74
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.5
4
+
5
+ - On `fact` failure of `Integer` `==`/`!=`/`>`/`>=`/`<`/`<=`, display the involved objects
6
+ - Support `fact` failure printout for frozen `Object`s
7
+
3
8
  ## 0.0.4
4
9
 
5
10
  - On `fact` failure of `Object` `==`/`!=`, display the involved objects
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Specification 0.0.4
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Specification 0.0.5
2
2
  ## Pure Ruby Declarative Use Case Specification and Automated Verification
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-specification.svg)](http://badge.fury.io/rb/glimmer-dsl-specification)
4
4
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -33,11 +33,11 @@ scenario 'person name consists of first name and last name' do
33
33
  end
34
34
  ```
35
35
 
36
- That states a few extra facts in addition to the last statement in the scenario denoting the final verification. Software engineers will not have to write awkward verification code they hate anymore (e.g. `assert` or `expect`) as even software verification code is written with basic Ruby.
36
+ That states a few extra facts in addition to the last statement in the scenario denoting the final verification. Software engineers will not have to write awkward verification code they hate anymore (e.g. `assert` or `expect`) as plain old Ruby comparison code gets the job done in [Glimmer DSL for Specification](https://rubygems.org/gems/glimmer-dsl-specification)!
37
37
 
38
38
  Note that this library is very new and experimental, so it might change course significantly. Also, despite the bold ambitious statements, there might be obvious blind spots that your feedback would help shine light upon to improve the library. As such, ideas and suggestions are greatly welcome.
39
39
 
40
- Other [Glimmer](https://rubygems.org/gems/glimmer) DSL gems you might be interested in:
40
+ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be interested in:
41
41
  - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
42
42
  - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
43
43
  - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
@@ -171,6 +171,12 @@ module Glimmer::Specification
171
171
  fact { person == nil }
172
172
  fact { person.nil? }
173
173
  fact { person != person }
174
+ fact { person.last_name.size == 3 }
175
+ fact { person.last_name.size > 13 }
176
+ fact { person.last_name.size >= 13 }
177
+ fact { person.last_name.size < 1 }
178
+ fact { person.last_name.size <= 1 }
179
+ fact { person.last_name.size != 7 }
174
180
  person.name == 'Bob Winfrey'
175
181
  end
176
182
  }
@@ -214,6 +220,18 @@ FAILED: #<Person:0x00007f832a93b778 @first_name="Bob", @last_name="Winfrey">.nil
214
220
  NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.nil? }
215
221
  FAILED: #<Person:0x00007f832a93b778 @first_name="Bob", @last_name="Winfrey"> != #<Person:0x00007f832a93b778 @first_name="Bob", @last_name="Winfrey">
216
222
  NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person != person }
223
+ FAILED: 7 == 3
224
+ NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.size == 3 }
225
+ FAILED: 7 > 13
226
+ NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.size > 13 }
227
+ FAILED: 7 >= 13
228
+ NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.size >= 13 }
229
+ FAILED: 7 < 1
230
+ NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.size < 1 }
231
+ FAILED: 7 <= 1
232
+ NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.size <= 1 }
233
+ FAILED: 7 != 7
234
+ NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.size != 7 }
217
235
  NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name
218
236
  NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts
219
237
  NOT VERIFIED: Glimmer DSL for Specification
@@ -224,7 +242,7 @@ NOT VERIFIED: Glimmer DSL for Specification
224
242
  1 - Include in `Gemfile` (`:development` or `:test` group):
225
243
 
226
244
  ```ruby
227
- gem 'glimmer-dsl-specification', '~> 0.0.4'
245
+ gem 'glimmer-dsl-specification', '~> 0.0.5'
228
246
  ```
229
247
 
230
248
  And, run:
@@ -289,7 +307,7 @@ Specifications do not care about what specific "classes" or "methods" are execut
289
307
 
290
308
  ### specification
291
309
 
292
- (nested directly under `Glimmer::Specification` module or under another `specification`.)
310
+ (nested directly under `Glimmer::Specification` module or under another `specification`)
293
311
 
294
312
  `specification(title)` is the top-level keyword denoting a requirement specification.
295
313
 
@@ -311,9 +329,10 @@ Specifications do not care about what specific "classes" or "methods" are execut
311
329
 
312
330
  `fact {}` states a fact embodied by a boolean result for the passed block of code.
313
331
 
314
- - Upon failure of a `fact` with `String` `==`/`!=`/`#empty?`/`#include?` verification methods, the library will automatically print the values of the involved objects.
315
- - Upon failure of a `fact` with `Array` `==`/`!=`/`#empty?`/`#include?` verification methods, the library will automatically print the values of the involved objects.
316
- - Upon failure of a `fact` with `Object` `==`/`!=` verification methods, the library will automatically print the values of the involved objects.
332
+ - Upon failure of a `fact` with `Object` `nil?`, `==`/`!=` verification methods, the library will automatically print the values of the involved objects.
333
+ - Upon failure of a `fact` with `String` `#empty?`/`#include?` verification methods, the library will automatically print the values of the involved objects.
334
+ - Upon failure of a `fact` with `Array` `#empty?`/`#include?` verification methods, the library will automatically print the values of the involved objects.
335
+ - Upon failure of a `fact` with `Integer` `>`/`>=`/`<`/`<=` verification methods, the library will automatically print the values of the involved objects.
317
336
 
318
337
  ## Process
319
338
 
data/TODO.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # TODO
2
2
 
3
- - Support `fact` printout on `Object`/`String`/`Array` `#nil?`
4
3
  - Detect if you are the last line of a `scenario` when performing a verification comparison and print compared objects upon failure
5
4
  - Ensure that each element is only nestable under specific types of elements (e.g. `use_case` can go under `specification` only and `fact` can go under `scenario` only)
6
5
  - Support setting up common `scenario`, `use case` or `specification` preconditions by adding code directly under their block or inside a `before`/`after` block
7
6
  - Support printing more than one line for `fact {}` (right now it assumes one line only, no multi-line support for printing)
8
7
  - Support scaffolding initial specification directory and lib_specification.rb for a project (or any initial file name passed as argument to scaffolding command); Also, automatically amend `Rakefile` to add `rake verify` task and potentially configure as default.
8
+ - Support usage of `pd` without getting caught up by failure printout logic
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-specification 0.0.4 ruby lib
5
+ # stub: glimmer-dsl-specification 0.0.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-specification".freeze
9
- s.version = "0.0.4"
9
+ s.version = "0.0.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
39
39
  "lib/glimmer/specification/element/use_case.rb",
40
40
  "lib/glimmer/specification/ext.rb",
41
41
  "lib/glimmer/specification/ext/array.rb",
42
+ "lib/glimmer/specification/ext/integer.rb",
42
43
  "lib/glimmer/specification/ext/object.rb",
43
44
  "lib/glimmer/specification/ext/string.rb",
44
45
  "lib/glimmer/specification/rake_tasks.rb"
@@ -21,7 +21,6 @@
21
21
 
22
22
  class Array
23
23
  Glimmer::Specification::Ext.log_failure_of_method(self, '==', 'double_equal_without_glimmer') { |this, method_name, args| "#{this.inspect} == #{args.first.inspect}" }
24
- Glimmer::Specification::Ext.log_failure_of_method(self, '!=', 'double_non_equal_without_glimmer') { |this, method_name, args| "#{this.inspect} != #{args.first.inspect}" }
25
24
  Glimmer::Specification::Ext.log_failure_of_method(self, 'empty?')
26
25
  Glimmer::Specification::Ext.log_failure_of_method(self, 'include?')
27
26
  end
@@ -0,0 +1,28 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class Integer < Numeric
23
+ Glimmer::Specification::Ext.log_failure_of_method(self, '==', 'double_equal_without_glimmer') { |this, method_name, args| "#{this.inspect} == #{args.first.inspect}" }
24
+ Glimmer::Specification::Ext.log_failure_of_method(self, '>', 'greater_without_glimmer') { |this, method_name, args| "#{this.inspect} > #{args.first.inspect}" }
25
+ Glimmer::Specification::Ext.log_failure_of_method(self, '<', 'less_without_glimmer') { |this, method_name, args| "#{this.inspect} < #{args.first.inspect}" }
26
+ Glimmer::Specification::Ext.log_failure_of_method(self, '>=', 'greater_or_equal_without_glimmer') { |this, method_name, args| "#{this.inspect} >= #{args.first.inspect}" }
27
+ Glimmer::Specification::Ext.log_failure_of_method(self, '<=', 'less_or_equal_without_glimmer') { |this, method_name, args| "#{this.inspect} <= #{args.first.inspect}" }
28
+ end
@@ -21,7 +21,6 @@
21
21
 
22
22
  class String
23
23
  Glimmer::Specification::Ext.log_failure_of_method(self, '==', 'double_equal_without_glimmer') { |this, method_name, args| "#{this.inspect} == #{args.first.inspect}" }
24
- Glimmer::Specification::Ext.log_failure_of_method(self, '!=', 'double_non_equal_without_glimmer') { |this, method_name, args| "#{this.inspect} != #{args.first.inspect}" }
25
24
  Glimmer::Specification::Ext.log_failure_of_method(self, 'empty?')
26
25
  Glimmer::Specification::Ext.log_failure_of_method(self, 'include?')
27
26
  end
@@ -35,15 +35,13 @@ module Glimmer
35
35
  alias_method method_alias, method_name
36
36
  define_method(method_name) do |*args|
37
37
  logging = false
38
- logging = Ext.log_failure_of_method_in_progress = true if !frozen? && !Ext.log_failure_of_method_in_progress?
38
+ logging = Ext.log_failure_of_method_in_progress = true if !Ext.log_failure_of_method_in_progress?
39
39
  send(method_alias, *args).tap do |result|
40
- unless frozen?
41
- if logging
42
- output = output_formatter&.call(self, method_name, args)
43
- output ||= "#{self.inspect}.#{method_name}#{"(#{args.map(&:inspect).join(',')})" unless args.array_without_glimmer_empty?}"
44
- puts Colours::RED + "FAILED: #{output}" if Glimmer::Specification::Element::Fact.fact_block_in_progress && !result
45
- Ext.log_failure_of_method_in_progress = false
46
- end
40
+ if logging
41
+ output = output_formatter&.call(self, method_name, args)
42
+ output ||= "#{self.inspect}.#{method_name}#{"(#{args.map(&:inspect).join(',')})" unless args.array_without_glimmer_empty?}"
43
+ puts Colours::RED + "FAILED: #{output}" if Glimmer::Specification::Element::Fact.fact_block_in_progress && !result
44
+ Ext.log_failure_of_method_in_progress = false
47
45
  end
48
46
  end
49
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-specification
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
@@ -123,6 +123,7 @@ files:
123
123
  - lib/glimmer/specification/element/use_case.rb
124
124
  - lib/glimmer/specification/ext.rb
125
125
  - lib/glimmer/specification/ext/array.rb
126
+ - lib/glimmer/specification/ext/integer.rb
126
127
  - lib/glimmer/specification/ext/object.rb
127
128
  - lib/glimmer/specification/ext/string.rb
128
129
  - lib/glimmer/specification/rake_tasks.rb