rcor 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/Rakefile.rb +39 -0
  2. data/lib/concordion.rb +66 -0
  3. data/lib/concordion_binder.rb +24 -0
  4. data/lib/concordion_constants.rb +13 -0
  5. data/lib/concordion_css.rb +172 -0
  6. data/lib/concordion_css_decorator.rb +52 -0
  7. data/lib/concordion_environment.rb +28 -0
  8. data/lib/concordion_instrumenter.rb +30 -0
  9. data/lib/concordion_invocation_string_builder.rb +24 -0
  10. data/lib/concordion_invoker.rb +33 -0
  11. data/lib/concordion_lookahead_handler.rb +17 -0
  12. data/lib/concordion_parse_result.rb +31 -0
  13. data/lib/concordion_parser.rb +47 -0
  14. data/lib/concordion_processor.rb +24 -0
  15. data/lib/concordion_reader.rb +18 -0
  16. data/lib/concordion_string_utility.rb +63 -0
  17. data/lib/concordion_string_writer.rb +13 -0
  18. data/lib/concordion_test_case.rb +97 -0
  19. data/lib/concordion_utility.rb +70 -0
  20. data/lib/concordion_verifier.rb +50 -0
  21. data/lib/concordion_writer.rb +43 -0
  22. data/lib/goldmaster_test_case.rb +32 -0
  23. data/lib/rcor.rb +2 -0
  24. data/nbproject/private/config.properties +0 -0
  25. data/nbproject/private/private.properties +4 -0
  26. data/nbproject/private/private.xml +10 -0
  27. data/nbproject/project.properties +11 -0
  28. data/nbproject/project.xml +16 -0
  29. data/test-lib/single_row_result.rb +9 -0
  30. data/test-lib/user.rb +8 -0
  31. data/tests/attr_assert.html +5 -0
  32. data/tests/attr_assert_test.rb +13 -0
  33. data/tests/basic_assert.html +5 -0
  34. data/tests/basic_assert_test.rb +9 -0
  35. data/tests/basic_assert_true.html +6 -0
  36. data/tests/basic_assert_true_test.rb +11 -0
  37. data/tests/basic_set.html +8 -0
  38. data/tests/basic_set_test.rb +8 -0
  39. data/tests/basic_text.html +6 -0
  40. data/tests/basic_text_test.rb +12 -0
  41. data/tests/concordion.css +2 -0
  42. data/tests/concordion_css_decorator_test.rb +28 -0
  43. data/tests/concordion_environment_test.rb +44 -0
  44. data/tests/concordion_parse_result_test.rb +33 -0
  45. data/tests/concordion_test.rb +49 -0
  46. data/tests/concordion_utility_test.rb +88 -0
  47. data/tests/concordion_verifier_test.rb +38 -0
  48. data/tests/concordion_writer_test.rb +26 -0
  49. data/tests/failing.html +5 -0
  50. data/tests/failing_test.rb +15 -0
  51. data/tests/goldmaster_failing.html +5 -0
  52. data/tests/goldmaster_failing_goldmaster.html +162 -0
  53. data/tests/goldmaster_failing_test.rb +11 -0
  54. data/tests/goldmaster_passing.html +5 -0
  55. data/tests/goldmaster_passing_goldmaster.html +162 -0
  56. data/tests/goldmaster_passing_test.rb +9 -0
  57. data/tests/goldmaster_table.html +46 -0
  58. data/tests/goldmaster_table_goldmaster.html +203 -0
  59. data/tests/goldmaster_table_test.rb +17 -0
  60. data/tests/lookahead_assert_true.html +25 -0
  61. data/tests/lookahead_assert_true_test.rb +17 -0
  62. data/tests/nested_element_lookahead.html +9 -0
  63. data/tests/nested_element_lookahead_test.rb +8 -0
  64. data/tests/processes_elements_in_sorted_order.html +12 -0
  65. data/tests/processes_elements_in_sorted_order_test.rb +13 -0
  66. data/tests/return_result.html +7 -0
  67. data/tests/return_result_test.rb +17 -0
  68. data/tests/single_row_table.html +13 -0
  69. data/tests/single_row_table_test.rb +9 -0
  70. data/tests/table.html +28 -0
  71. data/tests/table_test.rb +9 -0
  72. data/tests/test_helper.rb +9 -0
  73. data/tests/verify_rows.html +46 -0
  74. data/tests/verify_rows_scsr.html +27 -0
  75. data/tests/verify_rows_scsr_test.rb +15 -0
  76. data/tests/verify_rows_test.rb +16 -0
  77. metadata +142 -0
@@ -0,0 +1,46 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <p>Given these users:</p>
4
+
5
+ <table>
6
+ <tr>
7
+ <th concordion:set="#username">Username</th>
8
+ <th concordion:execute="setupUser(#username, #TEXT)">Other</th>
9
+ </tr>
10
+ <tr>
11
+ <td>john.lennon</td>
12
+ <td>monkeys</td>
13
+ </tr>
14
+ <tr>
15
+ <td>ringo.starr</td>
16
+ <td>chucknorris</td>
17
+ </tr>
18
+ <tr>
19
+ <td>george.harrison</td>
20
+ <td>dishwasher</td>
21
+ </tr>
22
+ <tr>
23
+ <td>paul.mcartney</td>
24
+ <td>flamingweasel</td>
25
+ </tr>
26
+ </table>
27
+
28
+ <p>Searching for "<b concordion:set="#searchString">arr</b>" will return:</p>
29
+
30
+ <table concordion:verifyRows="#users = getSearchResultsFor(#searchString)">
31
+ <tr>
32
+ <th concordion:assertEquals="#user.name">Matching Usernames</th>
33
+ <th concordion:assertEquals="#user.other">and their Other field</th>
34
+ </tr>
35
+ <tr>
36
+ <td>george.harrison</td>
37
+ <td>dishwasher</td>
38
+ </tr>
39
+ <tr>
40
+ <td>ringo.starr</td>
41
+ <td>chucknorris</td>
42
+ </tr>
43
+ </table>
44
+ </body>
45
+ </html>
46
+
@@ -0,0 +1,203 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion"><head><style type="text/css">* {
2
+ font-family: Arial;
3
+ }
4
+ body {
5
+ padding: 32px;
6
+ }
7
+ pre {
8
+ padding: 6px 28px 6px 28px;
9
+ background-color: #E8EEF7;
10
+ }
11
+ pre, pre *, code, kbd {
12
+ font-family: Courier New, Courier;
13
+ font-size: 10pt;
14
+ }
15
+ h1, h1 * {
16
+ font-size: 24pt;
17
+ }
18
+ p, td, th, li, .breadcrumbs {
19
+ font-size: 10pt;
20
+ }
21
+ p, li {
22
+ line-height: 140%;
23
+ }
24
+ table {
25
+ border-collapse: collapse;
26
+ empty-cells: show;
27
+ margin: 8px 0px 8px 0px;
28
+ }
29
+ th, td {
30
+ border: 1px solid black;
31
+ padding: 3px;
32
+ }
33
+ td {
34
+ background-color: white;
35
+ vertical-align: top;
36
+ }
37
+ th {
38
+ background-color: #C3D9FF;
39
+ }
40
+ li {
41
+ margin-top: 6px;
42
+ margin-bottom: 6px;
43
+ }
44
+
45
+
46
+ .example {
47
+ padding: 2px 12px 6px 12px;
48
+ border: 1px solid #C3D9FF;
49
+ margin: 6px 0px 28px 0px;
50
+ background-color: #F5F9FD;
51
+ }
52
+ .example h3 {
53
+ margin-top: 8px;
54
+ margin-bottom: 8px;
55
+ font-size: 12pt;
56
+ }
57
+
58
+ p.success {
59
+ padding: 2px;
60
+ }
61
+ .concordion_success, .concordion_success * {
62
+ background-color: #afa !important;
63
+ }
64
+ .success pre {
65
+ background-color: #bbffbb;
66
+ }
67
+ .concordion_failure, .concordion_failure * {
68
+ background-color: #ffb0b0;
69
+ padding: 1px;
70
+ }
71
+ .concordion_failure .expected {
72
+ text-decoration: line-through;
73
+ color: #bb5050;
74
+ }
75
+
76
+ ins {
77
+ text-decoration: none;
78
+ }
79
+
80
+ .exceptionMessage {
81
+ background-color: #fdd;
82
+ font-family: Courier New, Courier, Monospace;
83
+ font-size: 10pt;
84
+ display: block;
85
+ font-weight: normal;
86
+ padding: 4px;
87
+ text-decoration: none !important;
88
+ }
89
+ .stackTrace, .stackTrace * {
90
+ font-weight: normal;
91
+ }
92
+ .stackTrace {
93
+ display: none;
94
+ padding: 1px 4px 4px 4px;
95
+ background-color: #fdd;
96
+ border-top: 1px dotted black;
97
+ }
98
+ .stackTraceExceptionMessage {
99
+ display: block;
100
+ font-family: Courier New, Courier, Monospace;
101
+ font-size: 8pt;
102
+ white-space: wrap;
103
+ padding: 1px 0px 1px 0px;
104
+ }
105
+ .stackTraceEntry {
106
+ white-space: nowrap;
107
+ font-family: Courier New, Courier, Monospace;
108
+ display: block;
109
+ font-size: 8pt;
110
+ padding: 1px 0px 1px 32px;
111
+ }
112
+ .stackTraceButton {
113
+ font-size: 8pt;
114
+ margin: 2px 8px 2px 0px;
115
+ font-weight: normal;
116
+ font-family: Arial;
117
+ }
118
+
119
+ .special {
120
+ font-style: italic;
121
+ }
122
+ .missing, .missing * {
123
+ background-color: #ff9999;
124
+ }
125
+ .surplus, .surplus * {
126
+ background-color: #ff9999;
127
+ }
128
+ .footer {
129
+ text-align: right;
130
+ margin-top: 40px;
131
+ font-size: 8pt;
132
+ width: 100%;
133
+ color: #999;
134
+ }
135
+ .footer .testTime {
136
+ padding: 2px 10px 0px 0px;
137
+ }
138
+
139
+ .idea {
140
+ font-size: 9pt;
141
+ color: #888;
142
+ font-style: italic;
143
+ }
144
+ .tight li {
145
+ margin-top: 1px;
146
+ margin-bottom: 1px;
147
+ }
148
+ .commentary {
149
+ float: right;
150
+ width: 200px;
151
+ background-color: #ffffd0;
152
+ padding:8px;
153
+ border: 3px solid #eeeeb0;
154
+ margin: 10px 0px 10px 10px;
155
+ }
156
+ .commentary, .commentary * {
157
+ font-size: 8pt;
158
+ }</style></head>
159
+ <body>
160
+ <p>Given these users:</p>
161
+
162
+ <table>
163
+ <tr>
164
+ <th concordion:set="#username">Username</th>
165
+ <th concordion:execute="setupUser(#username, #TEXT)">Other</th>
166
+ </tr>
167
+ <tr>
168
+ <td class="concordion_success" concordion:set="#username">john.lennon</td>
169
+ <td class="concordion_success" concordion:execute="setupUser(#username, #TEXT)">monkeys</td>
170
+ </tr>
171
+ <tr>
172
+ <td class="concordion_success" concordion:set="#username">ringo.starr</td>
173
+ <td class="concordion_success" concordion:execute="setupUser(#username, #TEXT)">chucknorris</td>
174
+ </tr>
175
+ <tr>
176
+ <td class="concordion_success" concordion:set="#username">george.harrison</td>
177
+ <td class="concordion_success" concordion:execute="setupUser(#username, #TEXT)">dishwasher</td>
178
+ </tr>
179
+ <tr>
180
+ <td class="concordion_success" concordion:set="#username">paul.mcartney</td>
181
+ <td class="concordion_success" concordion:execute="setupUser(#username, #TEXT)">flamingweasel</td>
182
+ </tr>
183
+ </table>
184
+
185
+ <p>Searching for "<b class="concordion_success" concordion:set="#searchString">arr</b>" will return:</p>
186
+
187
+ <table class="concordion_success" concordion:verifyrows="#users = getSearchResultsFor(#searchString)">
188
+ <tr>
189
+ <th concordion:assertequals="#user.name">Matching Usernames</th>
190
+ <th concordion:assertequals="#user.other">and their Other field</th>
191
+ </tr>
192
+ <tr>
193
+ <td concordion:assertequals="#user.name" class="concordion_success">george.harrison</td>
194
+ <td concordion:assertequals="#user.other" class="concordion_success">dishwasher</td>
195
+ </tr>
196
+ <tr>
197
+ <td concordion:assertequals="#user.name" class="concordion_success">ringo.starr</td>
198
+ <td concordion:assertequals="#user.other" class="concordion_success">chucknorris</td>
199
+ </tr>
200
+ </table>
201
+ </body>
202
+ </html>
203
+
@@ -0,0 +1,17 @@
1
+ require 'goldmaster_test_case'
2
+ require 'user'
3
+
4
+ class GoldmasterTableTest < GoldmasterTestCase
5
+ def setup
6
+ @users = []
7
+ end
8
+
9
+ def setupUser(name, other)
10
+ @users << User.new(name,other)
11
+ end
12
+
13
+ def getSearchResultsFor(query)
14
+ @users.select {|u| u.name.include?(query) }.sort{|x,y| x.name <=> y.name}
15
+ end
16
+
17
+ end
@@ -0,0 +1,25 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <p>The greeting for user <span concordion:set="#firstName">Bob</span>
4
+ will be:
5
+ <span concordion:assertEquals="greeting_for(#firstName)">Hello Bob!</span>
6
+ </p>
7
+
8
+ <p>The first name
9
+ <span concordion:assertTrue="starts_with(#firstName, #letter)">starts
10
+ with <b concordion:set="#letter">B</b></span>.
11
+ </p>
12
+
13
+ <p>The first name
14
+ <span concordion:assertTrue="not_starts_with(#firstName, #letter)">starts
15
+ with <b concordion:set="#letter">Z</b></span>.
16
+ </p>
17
+
18
+ <p>The first name
19
+ <span concordion:assertTrue="starts_with(#firstName, #letter)">starts
20
+ with <b concordion:set="#letter">B</b></span>.
21
+ </p>
22
+
23
+
24
+ </body>
25
+ </html>
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class LookaheadAssertTrueTest < ConcordionTestCase
5
+ def starts_with(string, character)
6
+ string[0] == character[0]
7
+ end
8
+
9
+ def not_starts_with(string, character)
10
+ !starts_with(string,character)
11
+ end
12
+
13
+
14
+ def greeting_for(firstName)
15
+ 'Hello ' + firstName + '!'
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <p concordion:execute="#greeting = greetingFor(#firstName)">
4
+ The greeting "<span concordion:assertEquals="#greeting">Hello Bob!</span>"
5
+ should be given to user <span concordion:set="#firstName">Bob</span>
6
+ when he logs in.
7
+ </p>
8
+ </body>
9
+ </html>
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class NestedElementLookaheadTest < ConcordionTestCase
5
+ def greetingFor(name)
6
+ "Hello #{name}!"
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <span>p1:</span><p concordion:assertEquals="next()">1</p>
4
+ <span>p2:</span><p concordion:assertEquals="next()">2</p>
5
+ <span>p3:</span><p concordion:assertEquals="next()">3</p>
6
+ <span>s1:</span><span concordion:assertEquals="next()">4</span>
7
+ <span>p4:</span><p concordion:assertEquals="next()">5</p>
8
+ <span>s2:</span><span concordion:assertEquals="next()">6</span>
9
+ <span>s3:</span><span concordion:assertEquals="next()">7</span>
10
+ <span>p5:</span><p concordion:assertEquals="next()">8</p>
11
+ </body>
12
+ </html>
@@ -0,0 +1,13 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class ProcessesElementsInSortedOrderTest < ConcordionTestCase
5
+
6
+ def setup
7
+ @next_value = 0
8
+ end
9
+ def next
10
+ @next_value += 1
11
+ @next_value.to_s
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <p concordion:execute="#result = split_name(#TEXT)">No Way</p>
4
+ <p concordion:assertEquals="#result.first">No</p>
5
+ <p concordion:assertEquals="#result.last">Way</p>
6
+ </body>
7
+ </html>
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class ReturnResultTest < ConcordionTestCase
5
+ def split_name(name)
6
+ ar = ArbitraryResult.new
7
+ split = name.split(" ")
8
+ ar.first = split[0]
9
+ ar.last = split[1]
10
+
11
+ ar
12
+ end
13
+
14
+ class ArbitraryResult
15
+ attr_accessor :first, :last
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <table>
4
+ <tr>
5
+ <td concordion:execute="#row_result = split_by_colons(#TEXT)">a:b:c</td>
6
+ <td concordion:assertEquals="#row_result.alpha">A</td>
7
+ <td concordion:assertEquals="#row_result.beta">B</td>
8
+ <td concordion:assertEquals="#row_result.gamma">C</td>
9
+ </tr>
10
+
11
+ </table>
12
+ </body>
13
+ </html>
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+ require 'single_row_result'
4
+
5
+ class SingleRowTableTest < ConcordionTestCase
6
+ def split_by_colons(text)
7
+ SingleRowResult.new(text.split(":"))
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <table>
4
+ <tr>
5
+ <th concordion:execute="#row_result = split_by_colons(#TEXT)">Given Text:</th>
6
+ <th concordion:assertEquals="#row_result.alpha">First Field:</th>
7
+ <th concordion:assertEquals="#row_result.beta">Second Field:</th>
8
+ <th concordion:assertEquals="#row_result.gamma">Third Field:</th>
9
+ </tr>
10
+
11
+ <tr>
12
+ <td>a:b:c</td>
13
+ <td>A</td>
14
+ <td>B</td>
15
+ <td>C</td>
16
+ </tr>
17
+
18
+ <tr>
19
+ <td>d:e:f</td>
20
+ <td>D</td>
21
+ <td>E</td>
22
+ <td>F</td>
23
+ </tr>
24
+
25
+ </table>
26
+
27
+ </body>
28
+ </html>
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class TableTest < ConcordionTestCase
5
+ def split_by_colons(text)
6
+ SingleRowResult.new(text.split(":"))
7
+ end
8
+ end
9
+