features 0.1.4 → 0.2.0

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.

Potentially problematic release.


This version of features might be problematic. Click here for more details.

Files changed (77) hide show
  1. data/Manifest +59 -0
  2. data/README.markdown +31 -1
  3. data/Rakefile +1 -1
  4. data/features.gemspec +3 -3
  5. data/generators/features/templates/run_features.rb +27 -0
  6. data/lib/ObjC/objc_feature.rb +4 -27
  7. data/lib/ObjC/objc_scenario.rb +1 -58
  8. data/lib/ObjC/objc_step.rb +0 -31
  9. data/lib/ObjC/objc_suite.rb +14 -122
  10. data/lib/Rails/rails_feature.rb +7 -30
  11. data/lib/Rails/rails_scenario.rb +0 -57
  12. data/lib/Rails/rails_step.rb +1 -30
  13. data/lib/Rails/rails_suite.rb +16 -132
  14. data/lib/feature.rb +29 -1
  15. data/lib/scenario.rb +99 -0
  16. data/lib/step.rb +28 -0
  17. data/lib/suite.rb +124 -0
  18. data/website/README +10 -0
  19. data/website/Rakefile +44 -0
  20. data/website/config.yaml +18 -0
  21. data/website/deploy.rb +29 -0
  22. data/website/deploy/1251795725/features/browserfix.css +7 -0
  23. data/website/deploy/1251795725/features/default.css +257 -0
  24. data/website/deploy/1251795725/features/images/bodybg.gif +0 -0
  25. data/website/deploy/1251795725/features/images/header-bg.gif +0 -0
  26. data/website/deploy/1251795725/features/images/logo.png +0 -0
  27. data/website/deploy/1251795725/features/images/minus.png +0 -0
  28. data/website/deploy/1251795725/features/images/plus.png +0 -0
  29. data/website/deploy/1251795725/features/images/sidebarbg.gif +0 -0
  30. data/website/deploy/1251795725/features/index.html +229 -0
  31. data/website/deploy/1251796894/features/browserfix.css +7 -0
  32. data/website/deploy/1251796894/features/default.css +257 -0
  33. data/website/deploy/1251796894/features/images/bodybg.gif +0 -0
  34. data/website/deploy/1251796894/features/images/header-bg.gif +0 -0
  35. data/website/deploy/1251796894/features/images/logo.png +0 -0
  36. data/website/deploy/1251796894/features/images/minus.png +0 -0
  37. data/website/deploy/1251796894/features/images/output-screen-1.png +0 -0
  38. data/website/deploy/1251796894/features/images/plus.png +0 -0
  39. data/website/deploy/1251796894/features/images/sidebarbg.gif +0 -0
  40. data/website/deploy/1251796894/features/index.html +229 -0
  41. data/website/deploy/1251822430/features/browserfix.css +7 -0
  42. data/website/deploy/1251822430/features/default.css +257 -0
  43. data/website/deploy/1251822430/features/images/bodybg.gif +0 -0
  44. data/website/deploy/1251822430/features/images/header-bg.gif +0 -0
  45. data/website/deploy/1251822430/features/images/logo.png +0 -0
  46. data/website/deploy/1251822430/features/images/minus.png +0 -0
  47. data/website/deploy/1251822430/features/images/output-screen-1.png +0 -0
  48. data/website/deploy/1251822430/features/images/plus.png +0 -0
  49. data/website/deploy/1251822430/features/images/sidebarbg.gif +0 -0
  50. data/website/deploy/1251822430/features/index.html +229 -0
  51. data/website/ext/init.rb +10 -0
  52. data/website/out/browserfix.css +7 -0
  53. data/website/out/default.css +257 -0
  54. data/website/out/images/bodybg.gif +0 -0
  55. data/website/out/images/header-bg.gif +0 -0
  56. data/website/out/images/logo.png +0 -0
  57. data/website/out/images/minus.png +0 -0
  58. data/website/out/images/output-screen-1.png +0 -0
  59. data/website/out/images/plus.png +0 -0
  60. data/website/out/images/sidebarbg.gif +0 -0
  61. data/website/out/index.html +229 -0
  62. data/website/src/browserfix.css +7 -0
  63. data/website/src/default.css +257 -0
  64. data/website/src/default.template +92 -0
  65. data/website/src/images/bodybg.gif +0 -0
  66. data/website/src/images/deploy.rb +29 -0
  67. data/website/src/images/header-bg.gif +0 -0
  68. data/website/src/images/logo.png +0 -0
  69. data/website/src/images/minus.png +0 -0
  70. data/website/src/images/output-screen-1.png +0 -0
  71. data/website/src/images/plus.png +0 -0
  72. data/website/src/images/sidebarbg.gif +0 -0
  73. data/website/src/images/webgen.rb +3 -0
  74. data/website/src/index.page +139 -0
  75. data/website/webgen.cache +0 -0
  76. data/website/webgen.rb +3 -0
  77. metadata +61 -2
@@ -1,2 +1,30 @@
1
1
  class Step
2
+ attr_reader :message
3
+ attr_reader :body, :parent
4
+
5
+ def initialize(hash)
6
+ @body = hash[:body]
7
+ @parent = hash[:parent]
8
+ raise "No body given" unless body
9
+ end
10
+
11
+ def to_html
12
+ s = <<-END
13
+ <h3 class="step">#{body}</h3>
14
+ END
15
+ s.strip
16
+ end
17
+
18
+ def aggregate!
19
+ @message = first_part + args_string
20
+ self
21
+ end
22
+
23
+ def has_args?
24
+ !args.empty?
25
+ end
26
+
27
+ def args
28
+ @args ||= body.scan(/'([^']*)'/).map {|a| a[0]}
29
+ end
2
30
  end
@@ -1,2 +1,126 @@
1
1
  class Suite
2
+
3
+
4
+ def parse_output_file_and_open_in_browser(file)
5
+ results = ""
6
+ File.open(file) do |f|
7
+ f.readlines.each do |l|
8
+ results << l
9
+ end
10
+ end
11
+
12
+ html = parse_results(results).html
13
+
14
+ %x(touch '/tmp/out.html' && echo '#{html}' > /tmp/out.html && open '/tmp/out.html' )
15
+ end
16
+
17
+ def parse_results_and_open_in_safari(results)
18
+ html = parse_results(results).html
19
+ open_in_safari(html)
20
+ end
21
+
22
+ def open_in_safari(html)
23
+ %x(touch '/tmp/out.html' && echo '#{html}' > /tmp/out.html && open '/tmp/out.html' )
24
+ end
25
+
26
+ def parse_results(results="")
27
+ parse
28
+ @passed = true
29
+ features.each do |f|
30
+ f.scenarios.each do |s|
31
+ s.verify_status(results)
32
+ @passed &&= s.passed?
33
+ end
34
+ end
35
+ self
36
+ end
37
+
38
+ def passed?
39
+ @passed
40
+ end
41
+
42
+ def html
43
+ <<-END
44
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
45
+ <html>
46
+ <head>
47
+ <style type="text/css">
48
+ body {
49
+ font-family: Lucida Grande;
50
+ background-color: #FEFEFE;
51
+ padding: 5px;
52
+ }
53
+ * {-webkit-border-radius: 10px;}
54
+ body {background-color: #EEE; -webkit-border-radius: 0px;}
55
+ .feature { background-color: #E0E0E0;padding: 20px; margin: 20px;}
56
+ .scenario { background-color: #EEE; padding: 20px; margin: 20px}
57
+ .failed {border: 1px solid #C88; background-color: #B77; }
58
+ .passed {border: 1px solid #8C8; background-color: #7B7; }
59
+ .feature_title {font-size: 24pt; }
60
+ .story { font-size: 18pt; padding-left: 40px;}
61
+ #indicator { width: 100%; height: 20px; }
62
+ #wrap { background-color: #EEE; padding: 20px }
63
+ </style></head>
64
+ </head>
65
+ <body>
66
+ <div id="wrap">
67
+ <div id="header">
68
+ <div id="indicator" class="#{passed? ? "passed" : "failed"}">&nbsp;</div>
69
+ <h1 class="project_name">#{project_name}</h1>
70
+
71
+ </div>
72
+ #{features.map {|f| f.to_html }.join(" \n")}
73
+ </div>
74
+ </body>
75
+ </html>
76
+ END
77
+ end
78
+
79
+ def valid?
80
+ unique_feature_test_case_names?
81
+ end
82
+
83
+ def unique_feature_test_case_names?
84
+ feature_test_case_name = features.map {|f| f.test_case_name }
85
+ feature_test_case_name == feature_test_case_name.uniq
86
+ end
87
+
88
+ def run
89
+ parse
90
+ raise "Invalid: Duplicated Titles" unless valid?
91
+ File.open(test_cases_file, "w") { |f| f.puts self }
92
+ end
93
+
94
+ def parse
95
+ parse_features
96
+ parse_feature_scenarios
97
+ end
98
+
99
+ def parse_feature_scenarios
100
+ features.each do |feature|
101
+ feature.parse_scenarios
102
+ end
103
+ end
104
+
105
+ def all_feature_files
106
+ all_entries_in_feature_files_path = Dir.new(feature_files_path).entries
107
+ feature_entries = all_entries_in_feature_files_path.select do |file|
108
+ !!(file =~ /\.#{feature_file_suffix}$/)
109
+ end
110
+ feature_entries.map do |file|
111
+ feature_files_path + "/" + file
112
+ end
113
+ end
114
+
115
+ def all_feature_files_as_strings
116
+ feature_files.map do |file|
117
+ feature_string = ""
118
+ File.open(file) do |f|
119
+ f.readlines.each do |l|
120
+ feature_string << l
121
+ end
122
+ end
123
+ feature_string
124
+ end
125
+ end
2
126
  end
@@ -0,0 +1,10 @@
1
+ description:
2
+ This skeleton of a webgen website provides a set of default files for every
3
+ created webgen website.
4
+
5
+ When using the standard settings, the sources are in the directory `src` and
6
+ the generated output goes into `out`. Extensions can be placed under `ext`.
7
+
8
+ For configuration purposes, use the config.yaml file.
9
+ ---
10
+ note: This file can be deleted!
@@ -0,0 +1,44 @@
1
+ # -*- ruby -*-
2
+ #
3
+ # This is a sample Rakefile to which you can add tasks to manage your website. For example, users
4
+ # may use this file for specifying an upload task for their website (copying the output to a server
5
+ # via rsync, ftp, scp, ...).
6
+ #
7
+ # It also provides some tasks out of the box, for example, rendering the website, clobbering the
8
+ # generated files, an auto render task,...
9
+ #
10
+
11
+ require 'webgen/webgentask'
12
+
13
+ task :default => :webgen
14
+
15
+ Webgen::WebgenTask.new do |website|
16
+ website.clobber_outdir = true
17
+ website.config_block = lambda do |config|
18
+ # you can set configuration options here
19
+ end
20
+ end
21
+
22
+ desc "Render the website automatically on changes"
23
+ task :auto_webgen do
24
+ puts 'Starting auto-render mode'
25
+ time = Time.now
26
+ abort = false
27
+ old_paths = []
28
+ Signal.trap('INT') {abort = true}
29
+
30
+ while !abort
31
+ # you may need to adjust the glob so that all your sources are included
32
+ paths = Dir['src/**/*'].sort
33
+ if old_paths != paths || paths.any? {|p| File.mtime(p) > time}
34
+ begin
35
+ Rake::Task['webgen'].execute({})
36
+ rescue Webgen::Error => e
37
+ puts e.message
38
+ end
39
+ end
40
+ time = Time.now
41
+ old_paths = paths
42
+ sleep 2
43
+ end
44
+ end
@@ -0,0 +1,18 @@
1
+ # This is the YAML configuration file for webgen used to set configuration options.
2
+ #
3
+ # The general syntax is:
4
+ #
5
+ # configuration.option.name: value
6
+ #
7
+ # For example, to set a different default language, you would do:
8
+ #
9
+ # website.lang: de
10
+ #
11
+ # Have a look at the documentation of the individual configuration options to see
12
+ # the allowed format of the values. Since this is a YAML file, you can easily set
13
+ # configuration options as strings, integers, dates, arrays, hashes and more.
14
+ #
15
+ # The available configuration options can be found on the homepage in the
16
+ # Configuration Option Reference at
17
+ #
18
+ # http://webgen.rubyforge.org/documentation/reference_configuration.html
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ site_folder = File.expand_path(".")
4
+ puts "In #{site_folder}.:"
5
+ puts `webgen`
6
+
7
+
8
+ timestamp = Time.now.to_i
9
+ deploy_folder = "#{site_folder}/deploy/#{timestamp}/features"
10
+
11
+
12
+ `mkdir -p #{deploy_folder}`
13
+ if File.directory?(deploy_folder)
14
+ puts "Local Deploy Folder: #{deploy_folder}"
15
+ else
16
+ raise "Couldn't make deploy dir: #{deploy_folder}."
17
+ end
18
+
19
+ `cd #{site_folder}/out && cp -r * #{deploy_folder}`
20
+ puts Dir.entries(deploy_folder).join(" ")
21
+ if Dir.entries(deploy_folder).join(" ") =~ /\s*index.html\s*/
22
+ puts "Output moved to #{deploy_folder}"
23
+ else
24
+ raise "Couldn't copy output to #{deploy_folder}"
25
+ end
26
+
27
+ puts `cd #{deploy_folder} && cd .. && scp -r . mhennemeyer@rubyforge.org:/var/www/gforge-projects/features`
28
+
29
+ puts "Finished"
@@ -0,0 +1,7 @@
1
+ /**************** IE fixes ****************/
2
+
3
+ html
4
+ {overflow:hidden;}
5
+
6
+ body
7
+ {height:100%; width:100%; overflow:auto;}
@@ -0,0 +1,257 @@
1
+ /* reset */
2
+ * {
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+
7
+ /* No underlining */
8
+ a {
9
+ text-decoration: none;
10
+ }
11
+
12
+ a:hover {
13
+ color: #CFF;
14
+ }
15
+
16
+ h1, h2, h3, h4, h5, h6 {
17
+ -x-system-font: none;
18
+ color: black;
19
+ font-family: 'Trebuchet MS', Arial, Sans-serif;
20
+ font-size: 1.3em;
21
+ font-size-adjust: none;
22
+ font-stretch: normal;
23
+ font-style: normal;
24
+ font-variant: normal;
25
+ font-weight: bold;
26
+ line-height: normal;
27
+ }
28
+
29
+ h1 {
30
+ font-size: 1.8em;
31
+ }
32
+
33
+ h2 {
34
+ font-size: 1.5em;
35
+ }
36
+
37
+ body {
38
+ color: black;
39
+ -x-system-font: none;
40
+ font-family: Lucida Grande, Tahoma, 'Trebuchet MS', sans-serif;
41
+ font-size: 1em;
42
+ font-size-adjust: none;
43
+ font-stretch: normal;
44
+ font-style: normal;
45
+ font-variant: normal;
46
+ font-weight: normal;
47
+ line-height: 1.5em;
48
+ }
49
+
50
+ p, h1, h2, h3 {
51
+ margin: 0;
52
+ padding: 5px 0;
53
+ }
54
+
55
+ ul, ol {
56
+ margin: 10px 0;
57
+ padding: 0 15px;
58
+ }
59
+
60
+ img {
61
+ border: none;
62
+ }
63
+
64
+ .clearer {
65
+ clear: both;
66
+ height: 1px;
67
+ }
68
+
69
+
70
+ /* Header */
71
+
72
+ #header {
73
+ background: url("images/header-bg.gif");
74
+ color: white;
75
+ width: 100%;
76
+ }
77
+
78
+ #header-inner {
79
+ padding-top: 10px;
80
+ }
81
+
82
+ #header a {
83
+ color: white;
84
+ }
85
+
86
+ #logo {
87
+ float: left;
88
+ width: 15%;
89
+ }
90
+
91
+ #logo img {
92
+ display: block;
93
+ margin: 0 auto;
94
+ }
95
+
96
+ #site-name {
97
+ float: right;
98
+ width: 85%;
99
+ }
100
+
101
+ #site-name-inner-title {
102
+ color: white;
103
+ font-size: 36pt;
104
+ padding-bottom: 0;
105
+ }
106
+
107
+ #site-name-inner-slogan{
108
+ padding-top: 0;
109
+ }
110
+
111
+ /* Tabs */
112
+
113
+ #tabs {
114
+ color: white;
115
+ float: left;
116
+ margin-top: -1em;
117
+ text-align: right;
118
+ width: 70%;
119
+ }
120
+
121
+ #tabs a {
122
+ color: white;
123
+ font-size: 1.3em;
124
+ }
125
+
126
+ #tabs a:hover {
127
+ color: #CFF;
128
+ }
129
+
130
+
131
+ #tabs ul {
132
+ list-style-type: none;
133
+ }
134
+
135
+ #tabs li {
136
+ display: inline;
137
+ padding: 0.5em;
138
+ }
139
+
140
+ #tabs #current_tab a{
141
+ color: red;
142
+ font-size: 1.5em;
143
+ }
144
+
145
+ /* Main: Wraps sidebar and content*/
146
+
147
+ #main {
148
+ border-top: 3px solid #333;
149
+ background: gray;
150
+ margin: -1px auto 0 auto;
151
+ }
152
+
153
+ /* Right Sidebar*/
154
+
155
+ #sidebar {
156
+ background: gray;
157
+ float: right;
158
+ width: 30%;
159
+ }
160
+
161
+ #sidebar-inner {
162
+ padding: 20px;
163
+ }
164
+
165
+ #menu {
166
+ color: white;
167
+ font-size: 1.1em;
168
+ list-style-type: none;
169
+ }
170
+
171
+ #menu a {
172
+ color: white;
173
+ }
174
+
175
+ #menu a:hover {
176
+ color: #CFF;
177
+ }
178
+
179
+ #menu #current_page{
180
+ color: red;
181
+ font-size: 1.2em;
182
+ list-style-type: none;
183
+ }
184
+
185
+ #menu #current_page a {
186
+ color: red;
187
+ }
188
+
189
+ #menu #current_page a:hover {
190
+ color: #CFF;
191
+ }
192
+
193
+ #menu #current_page .outline {
194
+ list-style-type: none;
195
+ font-size: 0.6em;
196
+ color: black;
197
+ }
198
+
199
+ #menu #current_page .outline li a{
200
+ color: black;
201
+ }
202
+ /* Content */
203
+
204
+ #content {
205
+ background: #EEE;
206
+ float: left;
207
+ width: 70%;
208
+ }
209
+
210
+ #content-inner {
211
+ padding: 20px 40px 10px 40px;
212
+ }
213
+
214
+ #content h1 a {
215
+ color: gray;
216
+ font-size: 0.5em;
217
+ }
218
+
219
+ #content h2 a {
220
+ color: gray;
221
+ font-size: 0.5em;
222
+ }
223
+
224
+ #content h3 a {
225
+ color: gray;
226
+ font-size: 0.5em;
227
+ }
228
+
229
+ #content h4 a {
230
+ color: gray;
231
+ font-size: 0.5em;
232
+ }
233
+
234
+
235
+
236
+
237
+ /* Footer */
238
+
239
+ #footer {
240
+ background: url("images/header-bg.gif");
241
+ border-top: 3px solid #333;
242
+ border-bottom: 50px solid black;
243
+ color: white;
244
+ font-size: 1.3em;
245
+ margin-top: -3px;
246
+ text-align: center;
247
+ width: 100%;
248
+ }
249
+
250
+ #footer a {
251
+ color: white;
252
+ }
253
+
254
+
255
+ #footer-inner {
256
+ padding: 20px;
257
+ }