glimmer-dsl-specification 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +136 -8
- data/TODO.md +4 -0
- data/VERSION +1 -1
- data/glimmer-dsl-specification.gemspec +7 -2
- data/lib/glimmer/dsl/specification/attribute_expression.rb +21 -0
- data/lib/glimmer/dsl/specification/block_method_expression.rb +21 -0
- data/lib/glimmer/dsl/specification/dsl.rb +21 -0
- data/lib/glimmer/dsl/specification/element_expression.rb +21 -0
- data/lib/glimmer/specification/element/fact.rb +27 -0
- data/lib/glimmer/specification/element/scenario.rb +21 -0
- data/lib/glimmer/specification/element/specification.rb +21 -0
- data/lib/glimmer/specification/element/use_case.rb +21 -0
- data/lib/glimmer/specification/element.rb +21 -0
- data/lib/glimmer/specification/ext/array.rb +26 -0
- data/lib/glimmer/specification/ext/integer.rb +28 -0
- data/lib/glimmer/specification/ext/object.rb +26 -0
- data/lib/glimmer/specification/ext/string.rb +26 -0
- data/lib/glimmer/specification/ext.rb +55 -0
- data/lib/glimmer/specification/rake_tasks.rb +21 -0
- data/lib/glimmer/specification.rb +21 -0
- data/lib/glimmer-dsl-specification.rb +2 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c568e6f0d20ba4aa1684c7c33904fe7bc6e69a7435aba1c74e02218b2d0b21ee
|
4
|
+
data.tar.gz: 3b40f8f4bbe4cb91eb5b074eed08d7e7449b8ac742592bfc594eb6771bb60b5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8892bc418e5d49c843c044d3640e1020bb6140b0883895cec055cb66d6ccbea30a6a6535c0172f67898e884793868c6430a5c9451975c359701f40bf7c28fd99
|
7
|
+
data.tar.gz: 18066d69a02d797c05e3b96d0f6f14e422bb0047bffdf86d2b89e5eebbb36b16a8c925f3fc577cf24eb54b072f58600a44fefa989f99e366e357f4ebfe0a5b74
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
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
|
+
|
8
|
+
## 0.0.4
|
9
|
+
|
10
|
+
- On `fact` failure of `Object` `==`/`!=`, display the involved objects
|
11
|
+
- On `fact` failure of `Array` `==`/`!=`/`empty?`/`include?`, display the involved objects
|
12
|
+
|
13
|
+
## 0.0.3
|
14
|
+
|
15
|
+
- On `fact` failure of `String` `#empty?` and `#include?`, display the involved objects
|
16
|
+
|
17
|
+
## 0.0.2
|
18
|
+
|
19
|
+
- On `fact` failure of `String` equality or inequality, display the two compared objects
|
20
|
+
|
3
21
|
## 0.0.1
|
4
22
|
|
5
23
|
- Initial version with support for `specification`, `use_case`, `scenario`, and `fact` keywords.
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
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.
|
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)
|
5
5
|
|
6
6
|
Despite Ruby's highly expressive nature, all testing toolkits written in Ruby are either imperative (e.g. using `assert` or `expect`), thus losing expressiveness and focusing software engineers on the wrong thing, or mix non-Ruby code with Ruby (e.g. `cucumber` & `gherkin`), thus missing out on the simplicity of Ruby.
|
7
7
|
|
8
|
-
Glimmer DSL for Specification aims to provide a simple minimalistic and noun-based declarative syntax. No more verbs! It is time to think declaratively not imperatively!
|
8
|
+
[Glimmer](https://github.com/AndyObtiva/glimmer) DSL for Specification aims to provide a simple minimalistic and noun-based declarative syntax. No more verbs! It is time to think declaratively not imperatively!
|
9
9
|
|
10
10
|
As such, software engineers focus on [Requirements Specification](https://en.wikipedia.org/wiki/Software_requirements_specification) at the [Use Case](https://en.wikipedia.org/wiki/Use_case) level whereby each use case is composed of multiple scenarios. No need to specify scenario steps. The code is the steps!!!
|
11
11
|
|
@@ -33,7 +33,18 @@ 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.
|
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
|
+
|
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
|
+
|
40
|
+
Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems you might be interested in:
|
41
|
+
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
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
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
44
|
+
- [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
|
45
|
+
- [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
|
46
|
+
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
47
|
+
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
37
48
|
|
38
49
|
## Full Example
|
39
50
|
|
@@ -103,7 +114,77 @@ VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts
|
|
103
114
|
VERIFIED: Glimmer DSL for Specification
|
104
115
|
```
|
105
116
|
|
106
|
-
|
117
|
+
Suppose we fudge some code in `Verify Multiple Facts` use case:
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
require 'glimmer-dsl-specification'
|
121
|
+
|
122
|
+
class Person
|
123
|
+
attr_reader :first_name, :last_name
|
124
|
+
|
125
|
+
def initialize(first_name: , last_name: )
|
126
|
+
@first_name = first_name
|
127
|
+
@last_name = last_name
|
128
|
+
end
|
129
|
+
|
130
|
+
def name
|
131
|
+
"#{first_name} #{last_name}"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
module Glimmer::Specification
|
136
|
+
specification('Glimmer DSL for Specification') {
|
137
|
+
use_case('Compare Two Objects for Equality') {
|
138
|
+
scenario 'Same-content strings are equal' do
|
139
|
+
'string' == 'string'
|
140
|
+
end
|
141
|
+
|
142
|
+
scenario 'Different-content strings are not equal' do
|
143
|
+
'string1' != 'string2'
|
144
|
+
end
|
145
|
+
|
146
|
+
scenario 'Same-number integers are equal' do
|
147
|
+
1 == 1
|
148
|
+
end
|
149
|
+
|
150
|
+
scenario 'Different-number integers are not equal' do
|
151
|
+
1 != 2
|
152
|
+
end
|
153
|
+
}
|
154
|
+
|
155
|
+
use_case('Verify Multiple Facts') {
|
156
|
+
scenario 'person name consists of first name and last name' do
|
157
|
+
person = Person.new(first_name: 'Bob', last_name: 'Winfrey')
|
158
|
+
|
159
|
+
fact { person.first_name == 'Bob' }
|
160
|
+
fact { person.last_name == 'Winfrey' }
|
161
|
+
fact { person.last_name == 'aWinfrey' }
|
162
|
+
fact { person.last_name != 'Winfrey' }
|
163
|
+
fact { person.last_name.empty? }
|
164
|
+
fact { person.last_name.include?('fda') }
|
165
|
+
fact { person.last_name.nil? }
|
166
|
+
fact { [person.last_name] == ['aWinfrey'] }
|
167
|
+
fact { [person.last_name] != ['Winfrey'] }
|
168
|
+
fact { [person.last_name].empty? }
|
169
|
+
fact { [person.last_name].include?('ha') }
|
170
|
+
fact { [person.last_name].nil? }
|
171
|
+
fact { person == nil }
|
172
|
+
fact { person.nil? }
|
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 }
|
180
|
+
person.name == 'Bob Winfrey'
|
181
|
+
end
|
182
|
+
}
|
183
|
+
}
|
184
|
+
end
|
185
|
+
```
|
186
|
+
|
187
|
+
Failure output (colored in actual usage):
|
107
188
|
|
108
189
|
```
|
109
190
|
VERIFIED: Glimmer DSL for Specification - Compare Two Objects for Equality - Same-content strings are equal
|
@@ -113,6 +194,44 @@ VERIFIED: Glimmer DSL for Specification - Compare Two Objects for Equality - Dif
|
|
113
194
|
VERIFIED: Glimmer DSL for Specification - Compare Two Objects for Equality
|
114
195
|
VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.first_name == 'Bob' }
|
115
196
|
VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name == 'Winfrey' }
|
197
|
+
FAILED: "Winfrey" == "aWinfrey"
|
198
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name == 'aWinfrey' }
|
199
|
+
FAILED: "Winfrey" != "Winfrey"
|
200
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name != 'Winfrey' }
|
201
|
+
FAILED: "Winfrey".empty?
|
202
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.empty? }
|
203
|
+
FAILED: "Winfrey".include?("fda")
|
204
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.include?('fda') }
|
205
|
+
FAILED: "Winfrey".nil?
|
206
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.last_name.nil? }
|
207
|
+
FAILED: ["Winfrey"] == ["aWinfrey"]
|
208
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { [person.last_name] == ['aWinfrey'] }
|
209
|
+
FAILED: ["Winfrey"] != ["Winfrey"]
|
210
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { [person.last_name] != ['Winfrey'] }
|
211
|
+
FAILED: ["Winfrey"].empty?
|
212
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { [person.last_name].empty? }
|
213
|
+
FAILED: ["Winfrey"].include?("ha")
|
214
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { [person.last_name].include?('ha') }
|
215
|
+
FAILED: ["Winfrey"].nil?
|
216
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { [person.last_name].nil? }
|
217
|
+
FAILED: #<Person:0x00007f832a93b778 @first_name="Bob", @last_name="Winfrey"> == nil
|
218
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person == nil }
|
219
|
+
FAILED: #<Person:0x00007f832a93b778 @first_name="Bob", @last_name="Winfrey">.nil?
|
220
|
+
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name - fact { person.nil? }
|
221
|
+
FAILED: #<Person:0x00007f832a93b778 @first_name="Bob", @last_name="Winfrey"> != #<Person:0x00007f832a93b778 @first_name="Bob", @last_name="Winfrey">
|
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 }
|
116
235
|
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts - person name consists of first name and last name
|
117
236
|
NOT VERIFIED: Glimmer DSL for Specification - Verify Multiple Facts
|
118
237
|
NOT VERIFIED: Glimmer DSL for Specification
|
@@ -120,10 +239,10 @@ NOT VERIFIED: Glimmer DSL for Specification
|
|
120
239
|
|
121
240
|
## Usage
|
122
241
|
|
123
|
-
1 - Include in `Gemfile`
|
242
|
+
1 - Include in `Gemfile` (`:development` or `:test` group):
|
124
243
|
|
125
244
|
```ruby
|
126
|
-
gem 'glimmer-dsl-specification', '~> 0.0.
|
245
|
+
gem 'glimmer-dsl-specification', '~> 0.0.5'
|
127
246
|
```
|
128
247
|
|
129
248
|
And, run:
|
@@ -182,13 +301,13 @@ rake
|
|
182
301
|
|
183
302
|
The Domain Specific Language consists of the following keywords simply nested under `Glimmer::Specification` module (to avoid namespace pollution).
|
184
303
|
|
185
|
-
This library highly emphasizes declarative specification, so it avoids
|
304
|
+
This library highly emphasizes declarative specification, so it avoids unit-test jargon including "class", "method", "attribute", or "assert" as that is not the ultimate aim of the library, yet specifying application requirements.
|
186
305
|
|
187
306
|
Specifications do not care about what specific "classes" or "methods" are executed. They only care about meeting the verification criteria.
|
188
307
|
|
189
308
|
### specification
|
190
309
|
|
191
|
-
(nested directly under `Glimmer::Specification` module
|
310
|
+
(nested directly under `Glimmer::Specification` module or under another `specification`)
|
192
311
|
|
193
312
|
`specification(title)` is the top-level keyword denoting a requirement specification.
|
194
313
|
|
@@ -210,6 +329,11 @@ Specifications do not care about what specific "classes" or "methods" are execut
|
|
210
329
|
|
211
330
|
`fact {}` states a fact embodied by a boolean result for the passed block of code.
|
212
331
|
|
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.
|
336
|
+
|
213
337
|
## Process
|
214
338
|
|
215
339
|
[Glimmer Process](https://github.com/AndyObtiva/glimmer/blob/master/PROCESS.md)
|
@@ -258,3 +382,7 @@ If you need live help, try to [![Join the chat at https://gitter.im/AndyObtiva/g
|
|
258
382
|
|
259
383
|
Copyright (c) 2021 Andy Maleh. See
|
260
384
|
[LICENSE.txt](LICENSE.txt) for further details.
|
385
|
+
|
386
|
+
--
|
387
|
+
|
388
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=40 />](https://github.com/AndyObtiva/glimmer) Built for [Glimmer](https://github.com/AndyObtiva/glimmer) (DSL Framework).
|
data/TODO.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# TODO
|
2
2
|
|
3
|
+
- Detect if you are the last line of a `scenario` when performing a verification comparison and print compared objects upon failure
|
3
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)
|
4
5
|
- Support setting up common `scenario`, `use case` or `specification` preconditions by adding code directly under their block or inside a `before`/`after` block
|
6
|
+
- Support printing more than one line for `fact {}` (right now it assumes one line only, no multi-line support for printing)
|
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.
|
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.
|
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.
|
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]
|
@@ -37,6 +37,11 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/glimmer/specification/element/scenario.rb",
|
38
38
|
"lib/glimmer/specification/element/specification.rb",
|
39
39
|
"lib/glimmer/specification/element/use_case.rb",
|
40
|
+
"lib/glimmer/specification/ext.rb",
|
41
|
+
"lib/glimmer/specification/ext/array.rb",
|
42
|
+
"lib/glimmer/specification/ext/integer.rb",
|
43
|
+
"lib/glimmer/specification/ext/object.rb",
|
44
|
+
"lib/glimmer/specification/ext/string.rb",
|
40
45
|
"lib/glimmer/specification/rake_tasks.rb"
|
41
46
|
]
|
42
47
|
s.homepage = "http://github.com/AndyObtiva/glimmer-dsl-specification".freeze
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
require 'glimmer/dsl/expression'
|
2
23
|
|
3
24
|
module Glimmer
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
require 'glimmer/dsl/expression'
|
2
23
|
|
3
24
|
module Glimmer
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
require 'glimmer/dsl/engine'
|
2
23
|
Dir[File.expand_path('*_expression.rb', __dir__)].each {|f| require f}
|
3
24
|
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
require 'glimmer/dsl/expression'
|
2
23
|
require 'glimmer/dsl/parent_expression'
|
3
24
|
require 'glimmer/dsl/top_level_expression'
|
@@ -1,7 +1,32 @@
|
|
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
|
+
|
1
22
|
module Glimmer
|
2
23
|
module Specification
|
3
24
|
class Element
|
4
25
|
class Fact < Element
|
26
|
+
class << self
|
27
|
+
attr_accessor :fact_block_in_progress
|
28
|
+
end
|
29
|
+
|
5
30
|
def initialize(parent, keyword, *args, &block)
|
6
31
|
@executable = true
|
7
32
|
super
|
@@ -10,7 +35,9 @@ module Glimmer
|
|
10
35
|
end
|
11
36
|
|
12
37
|
def run
|
38
|
+
Fact.fact_block_in_progress = true
|
13
39
|
@verified = @block.call
|
40
|
+
Fact.fact_block_in_progress = false
|
14
41
|
if @verified
|
15
42
|
puts Colours::GREEN + "VERIFIED: #{to_s}"
|
16
43
|
else
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
module Glimmer
|
2
23
|
module Specification
|
3
24
|
class Element
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
module Glimmer
|
2
23
|
module Specification
|
3
24
|
class Element
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
module Glimmer
|
2
23
|
module Specification
|
3
24
|
class Element
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
module Glimmer
|
2
23
|
module Specification
|
3
24
|
class Element
|
@@ -0,0 +1,26 @@
|
|
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 Array
|
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, 'empty?')
|
25
|
+
Glimmer::Specification::Ext.log_failure_of_method(self, 'include?')
|
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
|
@@ -0,0 +1,26 @@
|
|
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 Object
|
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
|
+
Glimmer::Specification::Ext.log_failure_of_method(self, 'nil?')
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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 String
|
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, 'empty?')
|
25
|
+
Glimmer::Specification::Ext.log_failure_of_method(self, 'include?')
|
26
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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
|
+
using ArrayIncludeMethods
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module Specification
|
26
|
+
module Ext
|
27
|
+
class << self
|
28
|
+
attr_accessor :log_failure_of_method_in_progress
|
29
|
+
alias log_failure_of_method_in_progress? log_failure_of_method_in_progress
|
30
|
+
|
31
|
+
def log_failure_of_method(klass, method_name, method_alias = nil, &output_formatter)
|
32
|
+
klass.class_eval do
|
33
|
+
method_alias ||= "without_glimmer_#{method_name}"
|
34
|
+
method_alias = "#{name.split('::').last.underscore}_#{method_alias}"
|
35
|
+
alias_method method_alias, method_name
|
36
|
+
define_method(method_name) do |*args|
|
37
|
+
logging = false
|
38
|
+
logging = Ext.log_failure_of_method_in_progress = true if !Ext.log_failure_of_method_in_progress?
|
39
|
+
send(method_alias, *args).tap do |result|
|
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
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
Dir[File.expand_path('./ext/*.rb', __dir__)].each {|f| require f}
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
desc "Verify Glimmer Specifications"
|
2
23
|
task :verify do
|
3
24
|
Dir['specification/**/*_specification.rb'].each do |specification_file|
|
@@ -1,3 +1,24 @@
|
|
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
|
+
|
1
22
|
module Glimmer
|
2
23
|
module Specification
|
3
24
|
extend Glimmer
|
@@ -22,8 +22,10 @@
|
|
22
22
|
$LOAD_PATH.unshift(File.expand_path('.', __dir__))
|
23
23
|
|
24
24
|
require 'facets/string/camelcase'
|
25
|
+
require 'facets/string/underscore'
|
25
26
|
require 'puts_debuggerer'
|
26
27
|
require 'colours'
|
27
28
|
require 'glimmer'
|
28
29
|
require 'glimmer/dsl/specification/dsl'
|
29
30
|
require 'glimmer/specification'
|
31
|
+
require 'glimmer/specification/ext'
|
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
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
@@ -121,6 +121,11 @@ files:
|
|
121
121
|
- lib/glimmer/specification/element/scenario.rb
|
122
122
|
- lib/glimmer/specification/element/specification.rb
|
123
123
|
- lib/glimmer/specification/element/use_case.rb
|
124
|
+
- lib/glimmer/specification/ext.rb
|
125
|
+
- lib/glimmer/specification/ext/array.rb
|
126
|
+
- lib/glimmer/specification/ext/integer.rb
|
127
|
+
- lib/glimmer/specification/ext/object.rb
|
128
|
+
- lib/glimmer/specification/ext/string.rb
|
124
129
|
- lib/glimmer/specification/rake_tasks.rb
|
125
130
|
homepage: http://github.com/AndyObtiva/glimmer-dsl-specification
|
126
131
|
licenses:
|