gloo 6.4.0 → 6.5.1

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/docs/application.md +9 -0
  3. data/docs/language_objects.md +40 -0
  4. data/docs/objects.md +1 -1
  5. data/docs/verbs.md +9 -0
  6. data/lib/VERSION +1 -1
  7. data/lib/VERSION_NOTES +11 -0
  8. data/lib/gloo/app/engine.rb +5 -1
  9. data/lib/gloo/app/log.rb +5 -5
  10. data/lib/gloo/app/settings.rb +4 -1
  11. data/lib/gloo/core/obj.rb +21 -1
  12. data/lib/gloo/persist/file_loader.rb +7 -0
  13. data/lib/gloo/persist/persist_man.rb +35 -3
  14. data/lib/gloo/persist/source/obj_node.rb +41 -0
  15. data/lib/gloo/verbs/list.rb +24 -2
  16. data/lib/gloo/verbs/load.rb +13 -2
  17. data/test.gloo/ctrl/each.test.gloo +28 -30
  18. data/test.gloo/dt/date.test.gloo +69 -71
  19. data/test.gloo/dt/datetime.test.gloo +55 -57
  20. data/test.gloo/dt/time.test.gloo +70 -72
  21. data/test.gloo/lang/continuation.test.gloo +25 -27
  22. data/test.gloo/lang/convert.test.gloo +50 -52
  23. data/test.gloo/lang/dt_comparisons.test.gloo +87 -89
  24. data/test.gloo/lang/exceptions.test.gloo +42 -44
  25. data/test.gloo/lang/gloo_sys.test.gloo +100 -102
  26. data/test.gloo/lang/here.test.gloo +32 -34
  27. data/test.gloo/lang/it.test.gloo +27 -29
  28. data/test.gloo/lang/literal.test.gloo +55 -57
  29. data/test.gloo/lang/load_lib_directive.test.gloo +18 -20
  30. data/test.gloo/lang/naming.test.gloo +28 -30
  31. data/test.gloo/lang/ops.test.gloo +53 -55
  32. data/test.gloo/lang/shorthand.test.gloo +15 -17
  33. data/test.gloo/math/add.test.gloo +40 -42
  34. data/test.gloo/math/div.test.gloo +23 -25
  35. data/test.gloo/math/mult.test.gloo +23 -25
  36. data/test.gloo/math/sub.test.gloo +23 -25
  37. data/test.gloo/objs/alias.test.gloo +15 -17
  38. data/test.gloo/objs/bool.test.gloo +54 -56
  39. data/test.gloo/objs/can.test.gloo +33 -35
  40. data/test.gloo/objs/cipher.test.gloo +39 -41
  41. data/test.gloo/objs/decimal.test.gloo +27 -29
  42. data/test.gloo/objs/erb.test.gloo +47 -49
  43. data/test.gloo/objs/file.test.gloo +68 -70
  44. data/test.gloo/objs/function.test.gloo +37 -39
  45. data/test.gloo/objs/int.test.gloo +54 -56
  46. data/test.gloo/objs/json.test.gloo +56 -58
  47. data/test.gloo/objs/obj.test.gloo +68 -48
  48. data/test.gloo/objs/outline.test.gloo +48 -50
  49. data/test.gloo/objs/password.test.gloo +34 -36
  50. data/test.gloo/objs/repeat.test.gloo +42 -44
  51. data/test.gloo/objs/script.test.gloo +13 -15
  52. data/test.gloo/objs/string.test.gloo +82 -84
  53. data/test.gloo/objs/text.test.gloo +90 -92
  54. data/test.gloo/objs/untyped.test.gloo +36 -38
  55. data/test.gloo/objs/uri.test.gloo +37 -39
  56. data/test.gloo/verbs/break.test.gloo +12 -14
  57. data/test.gloo/verbs/check.test.gloo +22 -24
  58. data/test.gloo/verbs/context.test.gloo +11 -13
  59. data/test.gloo/verbs/create.test.gloo +7 -9
  60. data/test.gloo/verbs/eval.test.gloo +10 -12
  61. data/test.gloo/verbs/exists.test.gloo +43 -45
  62. data/test.gloo/verbs/if.test.gloo +8 -10
  63. data/test.gloo/verbs/invoke.test.gloo +73 -75
  64. data/test.gloo/verbs/list.test.gloo +21 -23
  65. data/test.gloo/verbs/load.test.gloo +27 -21
  66. data/test.gloo/verbs/log.test.gloo +7 -9
  67. data/test.gloo/verbs/move.test.gloo +12 -14
  68. data/test.gloo/verbs/put.test.gloo +10 -12
  69. data/test.gloo/verbs/reload.test.gloo +30 -32
  70. data/test.gloo/verbs/run.test.gloo +8 -10
  71. data/test.gloo/verbs/save.test.gloo +90 -94
  72. data/test.gloo/verbs/show.test.gloo +26 -28
  73. data/test.gloo/verbs/tell.test.gloo +8 -10
  74. data/test.gloo/verbs/throw.test.gloo +31 -33
  75. data/test.gloo/verbs/unless.test.gloo +13 -15
  76. data/test.gloo/verbs/unload.test.gloo +10 -12
  77. metadata +1 -1
@@ -2,36 +2,34 @@
2
2
  # Multiplication tests
3
3
  #
4
4
 
5
- tests [can] :
6
- math [can] :
7
- mult [can] :
5
+ tests.math.mult [can] :
8
6
 
9
- mult_ints [test] :
10
- description [string] : Multiply two integers
11
- on_test [script] :
12
- eval 2 * 3 = 6
13
- assert 'expected 2 * 3 = 6'
7
+ mult_ints [test] :
8
+ description [string] : Multiply two integers
9
+ on_test [script] :
10
+ eval 2 * 3 = 6
11
+ assert 'expected 2 * 3 = 6'
14
12
 
15
- eval 10 * 20 = 200
16
- assert 'expected 10 * 20 = 200'
13
+ eval 10 * 20 = 200
14
+ assert 'expected 10 * 20 = 200'
17
15
 
18
- eval 100 * 200 = 20000
19
- assert 'expected 100 * 200 = 20000'
16
+ eval 100 * 200 = 20000
17
+ assert 'expected 100 * 200 = 20000'
20
18
 
21
- eval 1 * 3 = 1
22
- refute 'expected 1 * 3 != 1'
19
+ eval 1 * 3 = 1
20
+ refute 'expected 1 * 3 != 1'
23
21
 
24
- mult_decimals [test] :
25
- description [string] : Multiply two decimals
26
- on_test [script] :
27
- eval 1.5 * 5.5 = 8.25
28
- assert 'expected 1.5 * 5.5 = 8.25'
22
+ mult_decimals [test] :
23
+ description [string] : Multiply two decimals
24
+ on_test [script] :
25
+ eval 1.5 * 5.5 = 8.25
26
+ assert 'expected 1.5 * 5.5 = 8.25'
29
27
 
30
- eval 10.5 * 20.5 = 214.5
31
- assert 'expected 10.5 * 20.5 = 214.5'
28
+ eval 10.5 * 20.5 = 214.5
29
+ assert 'expected 10.5 * 20.5 = 214.5'
32
30
 
33
- eval 100.5 * 200.5 = 20100.25
34
- assert 'expected 100.5 * 200.5 = 20100.25'
31
+ eval 100.5 * 200.5 = 20100.25
32
+ assert 'expected 100.5 * 200.5 = 20100.25'
35
33
 
36
- eval 1.5 * 10.5 = 10
37
- refute 'expected 1.5 * 10.5 != 10'
34
+ eval 1.5 * 10.5 = 10
35
+ refute 'expected 1.5 * 10.5 != 10'
@@ -2,36 +2,34 @@
2
2
  # Subtraction tests
3
3
  #
4
4
 
5
- tests [can] :
6
- math [can] :
7
- sub [can] :
5
+ tests.math.sub [can] :
8
6
 
9
- sub_ints [test] :
10
- description [string] : Subtract two integers
11
- on_test [script] :
12
- eval 2 - 3 = -1
13
- assert 'expected 2 - 3 = -1'
7
+ sub_ints [test] :
8
+ description [string] : Subtract two integers
9
+ on_test [script] :
10
+ eval 2 - 3 = -1
11
+ assert 'expected 2 - 3 = -1'
14
12
 
15
- eval 10 - 20 = -10
16
- assert 'expected 10 - 20 = -10'
13
+ eval 10 - 20 = -10
14
+ assert 'expected 10 - 20 = -10'
17
15
 
18
- eval 100 - 200 = -100
19
- assert 'expected 100 - 200 = -100'
16
+ eval 100 - 200 = -100
17
+ assert 'expected 100 - 200 = -100'
20
18
 
21
- eval 1 - 3 = -1
22
- refute 'expected 1 - 3 != -1'
19
+ eval 1 - 3 = -1
20
+ refute 'expected 1 - 3 != -1'
23
21
 
24
- sub_decimals [test] :
25
- description [string] : Subtract two decimals
26
- on_test [script] :
27
- eval 1.5 - 5.5 = -4
28
- assert 'expected 1.5 - 5.5 = -4'
22
+ sub_decimals [test] :
23
+ description [string] : Subtract two decimals
24
+ on_test [script] :
25
+ eval 1.5 - 5.5 = -4
26
+ assert 'expected 1.5 - 5.5 = -4'
29
27
 
30
- eval 10.5 - 20.5 = -10
31
- assert 'expected 10.5 - 20.5 = -10'
28
+ eval 10.5 - 20.5 = -10
29
+ assert 'expected 10.5 - 20.5 = -10'
32
30
 
33
- eval 100.5 - 200.5 = -100
34
- assert 'expected 100.5 - 200.5 = -100'
31
+ eval 100.5 - 200.5 = -100
32
+ assert 'expected 100.5 - 200.5 = -100'
35
33
 
36
- eval 1.5 - 10.5 = -1
37
- refute 'expected 1.5 - 10.5 != -1'
34
+ eval 1.5 - 10.5 = -1
35
+ refute 'expected 1.5 - 10.5 != -1'
@@ -2,23 +2,21 @@
2
2
  # Alias tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- alias [can] :
5
+ tests.objs.alias [can] :
8
6
 
9
- s [string] : hello
10
- ln [alias] : tests.objs.alias.s
7
+ s [string] : hello
8
+ ln [alias] : tests.objs.alias.s
11
9
 
12
- follow_alias [test] :
13
- description [string] : Follow an alias to the target value
14
- on_test [script] :
15
- put 'hello' into ^^.s
16
- eval ^^.ln = 'hello'
17
- assert "expected alias to resolve to 'hello'"
10
+ follow_alias [test] :
11
+ description [string] : Follow an alias to the target value
12
+ on_test [script] :
13
+ put 'hello' into ^^.s
14
+ eval ^^.ln = 'hello'
15
+ assert "expected alias to resolve to 'hello'"
18
16
 
19
- put_via_alias [test] :
20
- description [string] : Put a value via an alias
21
- on_test [script] :
22
- put 'world' into ^^.ln
23
- eval ^^.s = 'world'
24
- assert "expected s to be updated via alias"
17
+ put_via_alias [test] :
18
+ description [string] : Put a value via an alias
19
+ on_test [script] :
20
+ put 'world' into ^^.ln
21
+ eval ^^.s = 'world'
22
+ assert "expected s to be updated via alias"
@@ -2,59 +2,57 @@
2
2
  # Boolean tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- bool [can] :
8
-
9
- a [boolean] :
10
- b [boolean] :
11
-
12
- set_value_with_msg [test] :
13
- description [string] : Set the value of the boolean
14
- on_test [script] :
15
- tell ^^.b to true
16
- assert "expected it to be true"
17
-
18
- eval ^^.b
19
- assert "expected b to be true"
20
-
21
- tell ^^.b to false
22
- refute "expected it to be false"
23
-
24
- eval ^^.b
25
- refute "expected b to be false"
26
-
27
- not_value [test] :
28
- description [string] : Set the value of the boolean and not it
29
- on_test [script] :
30
- tell ^^.b to true
31
- tell ^^.b to not
32
- refute "expected it to be false"
33
-
34
- tell ^^.b to false
35
- tell ^^.b to not
36
- assert "expected it to be true"
37
-
38
- compare_values [test] :
39
- description [string] : Compare the value of two booleans
40
- on_test [script] :
41
- tell ^^.a to true
42
- put true into ^^.b
43
- eval ^^.b = ^^.a
44
- assert "expected both to be true"
45
-
46
- tell ^^.a to false
47
- put false into ^^.b
48
- eval ^^.b = ^^.a
49
- assert "expected both to be false"
50
-
51
- set_value [test] :
52
- description [string] : Set the value of the boolean
53
- on_test [script] :
54
- put true into ^^.b
55
- eval ^^.b = true
56
- assert "expected b to be true"
57
-
58
- put false into ^^.b
59
- eval ^^.b = false
60
- assert "expected b to be false"
5
+ tests.objs.bool [can] :
6
+
7
+ a [boolean] :
8
+ b [boolean] :
9
+
10
+ set_value_with_msg [test] :
11
+ description [string] : Set the value of the boolean
12
+ on_test [script] :
13
+ tell ^^.b to true
14
+ assert "expected it to be true"
15
+
16
+ eval ^^.b
17
+ assert "expected b to be true"
18
+
19
+ tell ^^.b to false
20
+ refute "expected it to be false"
21
+
22
+ eval ^^.b
23
+ refute "expected b to be false"
24
+
25
+ not_value [test] :
26
+ description [string] : Set the value of the boolean and not it
27
+ on_test [script] :
28
+ tell ^^.b to true
29
+ tell ^^.b to not
30
+ refute "expected it to be false"
31
+
32
+ tell ^^.b to false
33
+ tell ^^.b to not
34
+ assert "expected it to be true"
35
+
36
+ compare_values [test] :
37
+ description [string] : Compare the value of two booleans
38
+ on_test [script] :
39
+ tell ^^.a to true
40
+ put true into ^^.b
41
+ eval ^^.b = ^^.a
42
+ assert "expected both to be true"
43
+
44
+ tell ^^.a to false
45
+ put false into ^^.b
46
+ eval ^^.b = ^^.a
47
+ assert "expected both to be false"
48
+
49
+ set_value [test] :
50
+ description [string] : Set the value of the boolean
51
+ on_test [script] :
52
+ put true into ^^.b
53
+ eval ^^.b = true
54
+ assert "expected b to be true"
55
+
56
+ put false into ^^.b
57
+ eval ^^.b = false
58
+ assert "expected b to be false"
@@ -2,46 +2,44 @@
2
2
  # Container tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- can [can] :
5
+ tests.objs.can [can] :
8
6
 
9
- a [can] :
10
- b [string] : "b"
11
- c [string] : "c"
12
- d [string] : "d"
7
+ a [can] :
8
+ b [string] : "b"
9
+ c [string] : "c"
10
+ d [string] : "d"
13
11
 
14
- count_children [test] :
15
- description [string] : Verify the number of children
16
- on_test [script] :
17
- tell tests.objs.can.a to count
18
- eval it = 3
19
- assert "expected it to be 3"
12
+ count_children [test] :
13
+ description [string] : Verify the number of children
14
+ on_test [script] :
15
+ tell tests.objs.can.a to count
16
+ eval it = 3
17
+ assert "expected it to be 3"
20
18
 
21
- test_contains [test] :
22
- description [string] : Verify the container contains
23
- on_test [script] :
24
- check tests.objs.can.a for contains?
25
- assert "expected can to contains"
19
+ test_contains [test] :
20
+ description [string] : Verify the container contains
21
+ on_test [script] :
22
+ check tests.objs.can.a for contains?
23
+ assert "expected can to contains"
26
24
 
27
- check tests.objs.can.a.b for contains?
28
- refute "expected string to not contains"
25
+ check tests.objs.can.a.b for contains?
26
+ refute "expected string to not contains"
29
27
 
30
- create_container [test] :
31
- description [string] : Create a container and verify
32
- on_test [script] :
33
- create tests.objs.can.c as container
34
- tell tests.objs.can.c to count
35
- eval it = 0
36
- assert "expected it to be 0"
28
+ create_container [test] :
29
+ description [string] : Create a container and verify
30
+ on_test [script] :
31
+ create tests.objs.can.c as container
32
+ tell tests.objs.can.c to count
33
+ eval it = 0
34
+ assert "expected it to be 0"
37
35
 
38
- create tests.objs.can.c.s as string
39
- tell tests.objs.can.c to count
40
- eval it = 1
41
- assert "expected it to be 1"
36
+ create tests.objs.can.c.s as string
37
+ tell tests.objs.can.c to count
38
+ eval it = 1
39
+ assert "expected it to be 1"
42
40
 
43
- tell tests.objs.can.c to delete_children
44
- tell tests.objs.can.c to count
45
- eval it = 0
46
- assert "expected it to be 0"
41
+ tell tests.objs.can.c to delete_children
42
+ tell tests.objs.can.c to count
43
+ eval it = 0
44
+ assert "expected it to be 0"
47
45
 
@@ -2,44 +2,42 @@
2
2
  # Cipher object tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- cipher [can] :
8
-
9
- plaintext [string] : attack at dawn
10
-
11
- round_trip [test] :
12
- description [string] : encrypt then decrypt returns the original text.
13
- on_test [script] :
14
- create tests.objs.cipher.c as cipher
15
-
16
- tell tests.objs.cipher.c to generate_keys
17
- check tests.objs.cipher.c.key for blank?
18
- refute "expected generate_keys to set a key"
19
-
20
- put ^^.plaintext into tests.objs.cipher.c.data
21
- tell tests.objs.cipher.c to encrypt
22
- eval tests.objs.cipher.c.data = ^^.plaintext
23
- refute "expected the data to be encrypted (not the plaintext)"
24
-
25
- tell tests.objs.cipher.c to decrypt
26
- eval tests.objs.cipher.c.data = ^^.plaintext
27
- assert "expected decrypt to restore the original text"
28
-
29
- shared_keys [test] :
30
- description [string] : a second cipher with the same key + init_vector can decrypt.
31
- on_test [script] :
32
- create tests.objs.cipher.a as cipher
33
- create tests.objs.cipher.b as cipher
34
-
35
- tell tests.objs.cipher.a to generate_keys
36
- put ^^.plaintext into tests.objs.cipher.a.data
37
- tell tests.objs.cipher.a to encrypt
38
-
39
- put tests.objs.cipher.a.key into tests.objs.cipher.b.key
40
- put tests.objs.cipher.a.init_vector into tests.objs.cipher.b.init_vector
41
- put tests.objs.cipher.a.data into tests.objs.cipher.b.data
42
-
43
- tell tests.objs.cipher.b to decrypt
44
- eval tests.objs.cipher.b.data = ^^.plaintext
45
- assert "expected the second cipher to decrypt with the shared key"
5
+ tests.objs.cipher [can] :
6
+
7
+ plaintext [string] : attack at dawn
8
+
9
+ round_trip [test] :
10
+ description [string] : encrypt then decrypt returns the original text.
11
+ on_test [script] :
12
+ create tests.objs.cipher.c as cipher
13
+
14
+ tell tests.objs.cipher.c to generate_keys
15
+ check tests.objs.cipher.c.key for blank?
16
+ refute "expected generate_keys to set a key"
17
+
18
+ put ^^.plaintext into tests.objs.cipher.c.data
19
+ tell tests.objs.cipher.c to encrypt
20
+ eval tests.objs.cipher.c.data = ^^.plaintext
21
+ refute "expected the data to be encrypted (not the plaintext)"
22
+
23
+ tell tests.objs.cipher.c to decrypt
24
+ eval tests.objs.cipher.c.data = ^^.plaintext
25
+ assert "expected decrypt to restore the original text"
26
+
27
+ shared_keys [test] :
28
+ description [string] : a second cipher with the same key + init_vector can decrypt.
29
+ on_test [script] :
30
+ create tests.objs.cipher.a as cipher
31
+ create tests.objs.cipher.b as cipher
32
+
33
+ tell tests.objs.cipher.a to generate_keys
34
+ put ^^.plaintext into tests.objs.cipher.a.data
35
+ tell tests.objs.cipher.a to encrypt
36
+
37
+ put tests.objs.cipher.a.key into tests.objs.cipher.b.key
38
+ put tests.objs.cipher.a.init_vector into tests.objs.cipher.b.init_vector
39
+ put tests.objs.cipher.a.data into tests.objs.cipher.b.data
40
+
41
+ tell tests.objs.cipher.b to decrypt
42
+ eval tests.objs.cipher.b.data = ^^.plaintext
43
+ assert "expected the second cipher to decrypt with the shared key"
@@ -2,37 +2,35 @@
2
2
  # Decimal tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- decimal [can] :
5
+ tests.objs.decimal [can] :
8
6
 
9
- a [decimal] :
7
+ a [decimal] :
10
8
 
11
- set_value [test] :
12
- description [string] : Set a decimal value
13
- on_test [script] :
14
- put 3.14 into ^^.a
15
- eval ^^.a = 3.14
16
- assert "expected a to be 3.14"
9
+ set_value [test] :
10
+ description [string] : Set a decimal value
11
+ on_test [script] :
12
+ put 3.14 into ^^.a
13
+ eval ^^.a = 3.14
14
+ assert "expected a to be 3.14"
17
15
 
18
- round_decimal [test] :
19
- description [string] : Round a decimal value
20
- on_test [script] :
21
- put 3.7 into ^^.a
22
- tell ^^.a to round
23
- eval ^^.a = 4.0
24
- assert "expected a to be rounded to 4.0"
16
+ round_decimal [test] :
17
+ description [string] : Round a decimal value
18
+ on_test [script] :
19
+ put 3.7 into ^^.a
20
+ tell ^^.a to round
21
+ eval ^^.a = 4.0
22
+ assert "expected a to be rounded to 4.0"
25
23
 
26
- format_decimal [test] :
27
- description [string] : Format a decimal
28
- f [decimal] :
29
- on_test [script] :
30
- put 1234567.891 into ^.f
31
- tell ^.f to format
32
- eval it = '1,234,567.891'
33
- assert "expected formatted decimal to match"
24
+ format_decimal [test] :
25
+ description [string] : Format a decimal
26
+ f [decimal] :
27
+ on_test [script] :
28
+ put 1234567.891 into ^.f
29
+ tell ^.f to format
30
+ eval it = '1,234,567.891'
31
+ assert "expected formatted decimal to match"
34
32
 
35
- put 3.14159 into ^.f
36
- tell ^.f to format ('%.2f')
37
- eval it = '3.14'
38
- assert "expected formatted decimal to match"
33
+ put 3.14159 into ^.f
34
+ tell ^.f to format ('%.2f')
35
+ eval it = '3.14'
36
+ assert "expected formatted decimal to match"
@@ -2,52 +2,50 @@
2
2
  # ERB tests
3
3
  #
4
4
 
5
- tests [can] :
6
- objs [can] :
7
- erb [can] :
8
-
9
- greeting [string] : <%= name %>!!
10
-
11
- basic [erb] :
12
- template [text] : <%= name %>
13
- params [can] :
14
- name [string] : world
15
- result [text] :
16
-
17
- aliased_template [erb] :
18
- template [alias] : tests.objs.erb.greeting
19
- params [can] :
20
- name [string] : gloo
21
- result [text] :
22
-
23
- with_logic [erb] :
24
- template [text] : <%= n == "yes" ? "ACTIVE" : "closed" %>
25
- params [can] :
26
- n [string] : no
27
- result [text] :
28
-
29
- run_basic [test] :
30
- description [string] : Render a template with a param
31
- on_test [script] :
32
- tell ^^.basic to run
33
- eval ^^.basic.result = 'world'
34
- assert "expected template to render with the param value"
35
-
36
- run_with_aliased_template [test] :
37
- description [string] : Render a template whose 'template' child is an alias to another object
38
- on_test [script] :
39
- tell ^^.aliased_template to run
40
- eval ^^.aliased_template.result = 'gloo!!'
41
- assert "expected alias to be resolved before rendering the template"
42
-
43
- run_with_logic [test] :
44
- description [string] : A <% %> tag runs Ruby; the param drives which branch renders
45
- on_test [script] :
46
- tell ^^.with_logic to run
47
- eval ^^.with_logic.result = 'closed'
48
- assert "expected the 'no' param to render the closed branch"
49
-
50
- put 'yes' into ^^.with_logic.params.n
51
- tell ^^.with_logic to run
52
- eval ^^.with_logic.result = 'ACTIVE'
53
- assert "expected the 'yes' param to render the ACTIVE branch"
5
+ tests.objs.erb [can] :
6
+
7
+ greeting [string] : <%= name %>!!
8
+
9
+ basic [erb] :
10
+ template [text] : <%= name %>
11
+ params [can] :
12
+ name [string] : world
13
+ result [text] :
14
+
15
+ aliased_template [erb] :
16
+ template [alias] : tests.objs.erb.greeting
17
+ params [can] :
18
+ name [string] : gloo
19
+ result [text] :
20
+
21
+ with_logic [erb] :
22
+ template [text] : <%= n == "yes" ? "ACTIVE" : "closed" %>
23
+ params [can] :
24
+ n [string] : no
25
+ result [text] :
26
+
27
+ run_basic [test] :
28
+ description [string] : Render a template with a param
29
+ on_test [script] :
30
+ tell ^^.basic to run
31
+ eval ^^.basic.result = 'world'
32
+ assert "expected template to render with the param value"
33
+
34
+ run_with_aliased_template [test] :
35
+ description [string] : Render a template whose 'template' child is an alias to another object
36
+ on_test [script] :
37
+ tell ^^.aliased_template to run
38
+ eval ^^.aliased_template.result = 'gloo!!'
39
+ assert "expected alias to be resolved before rendering the template"
40
+
41
+ run_with_logic [test] :
42
+ description [string] : A <% %> tag runs Ruby; the param drives which branch renders
43
+ on_test [script] :
44
+ tell ^^.with_logic to run
45
+ eval ^^.with_logic.result = 'closed'
46
+ assert "expected the 'no' param to render the closed branch"
47
+
48
+ put 'yes' into ^^.with_logic.params.n
49
+ tell ^^.with_logic to run
50
+ eval ^^.with_logic.result = 'ACTIVE'
51
+ assert "expected the 'yes' param to render the ACTIVE branch"