jnicklas-courgette 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +87 -0
  3. data/PostInstall.txt +7 -0
  4. data/README.rdoc +53 -0
  5. data/Rakefile +27 -0
  6. data/app/controllers/features_controller.rb +14 -0
  7. data/app/views/features/index.html.erb +19 -0
  8. data/app/views/features/show.html.erb +3 -0
  9. data/app/views/layouts/courgette.html.erb +94 -0
  10. data/config/routes.rb +3 -0
  11. data/courgette.gemspec +44 -0
  12. data/features/list_features.feature +11 -0
  13. data/features/show_feature.feature +23 -0
  14. data/features/step_definitions/courgette_steps.rb +25 -0
  15. data/features/step_definitions/webrat_steps.rb +104 -0
  16. data/features/support/env.rb +23 -0
  17. data/fixture_rails_root/README +243 -0
  18. data/fixture_rails_root/Rakefile +10 -0
  19. data/fixture_rails_root/app/controllers/application_controller.rb +10 -0
  20. data/fixture_rails_root/app/helpers/application_helper.rb +3 -0
  21. data/fixture_rails_root/app/views/home/index.html.erb +2 -0
  22. data/fixture_rails_root/app/views/layouts/application.html.erb +18 -0
  23. data/fixture_rails_root/config/boot.rb +110 -0
  24. data/fixture_rails_root/config/database.yml +22 -0
  25. data/fixture_rails_root/config/environment.rb +18 -0
  26. data/fixture_rails_root/config/environments/development.rb +17 -0
  27. data/fixture_rails_root/config/environments/production.rb +28 -0
  28. data/fixture_rails_root/config/environments/test.rb +28 -0
  29. data/fixture_rails_root/config/initializers/backtrace_silencers.rb +7 -0
  30. data/fixture_rails_root/config/initializers/inflections.rb +10 -0
  31. data/fixture_rails_root/config/initializers/mime_types.rb +5 -0
  32. data/fixture_rails_root/config/initializers/new_rails_defaults.rb +19 -0
  33. data/fixture_rails_root/config/initializers/session_store.rb +15 -0
  34. data/fixture_rails_root/config/locales/en.yml +5 -0
  35. data/fixture_rails_root/config/routes.rb +3 -0
  36. data/fixture_rails_root/db/development.sqlite3 +0 -0
  37. data/fixture_rails_root/db/migrate/20090720193349_add_users.rb +20 -0
  38. data/fixture_rails_root/db/schema.rb +27 -0
  39. data/fixture_rails_root/db/test.sqlite3 +0 -0
  40. data/fixture_rails_root/doc/README_FOR_APP +2 -0
  41. data/fixture_rails_root/features/step_definitions/webrat_steps.rb +115 -0
  42. data/fixture_rails_root/features/support/env.rb +17 -0
  43. data/fixture_rails_root/features/support/paths.rb +29 -0
  44. data/fixture_rails_root/features/user_eats_rabbits.feature +17 -0
  45. data/fixture_rails_root/features/visitor_transforms.feature +14 -0
  46. data/fixture_rails_root/lib/tasks/cucumber.rake +15 -0
  47. data/fixture_rails_root/public/404.html +30 -0
  48. data/fixture_rails_root/public/422.html +30 -0
  49. data/fixture_rails_root/public/500.html +30 -0
  50. data/fixture_rails_root/public/favicon.ico +0 -0
  51. data/fixture_rails_root/public/images/rails.png +0 -0
  52. data/fixture_rails_root/public/index.html +275 -0
  53. data/fixture_rails_root/public/javascripts/application.js +2 -0
  54. data/fixture_rails_root/public/javascripts/controls.js +963 -0
  55. data/fixture_rails_root/public/javascripts/dragdrop.js +973 -0
  56. data/fixture_rails_root/public/javascripts/effects.js +1128 -0
  57. data/fixture_rails_root/public/javascripts/prototype.js +4320 -0
  58. data/fixture_rails_root/public/robots.txt +5 -0
  59. data/fixture_rails_root/script/about +4 -0
  60. data/fixture_rails_root/script/console +3 -0
  61. data/fixture_rails_root/script/cucumber +8 -0
  62. data/fixture_rails_root/script/dbconsole +3 -0
  63. data/fixture_rails_root/script/destroy +3 -0
  64. data/fixture_rails_root/script/generate +3 -0
  65. data/fixture_rails_root/script/performance/benchmarker +3 -0
  66. data/fixture_rails_root/script/performance/profiler +3 -0
  67. data/fixture_rails_root/script/plugin +3 -0
  68. data/fixture_rails_root/script/runner +3 -0
  69. data/fixture_rails_root/script/server +3 -0
  70. data/fixture_rails_root/spec/controllers/home_controller_spec.rb +17 -0
  71. data/fixture_rails_root/spec/helpers/home_helper_spec.rb +11 -0
  72. data/fixture_rails_root/spec/views/home/index.html.erb_spec.rb +12 -0
  73. data/fixture_rails_root/test/fixtures/users.yml +7 -0
  74. data/fixture_rails_root/test/performance/browsing_test.rb +9 -0
  75. data/fixture_rails_root/test/test_helper.rb +38 -0
  76. data/fixture_rails_root/test/unit/user_test.rb +8 -0
  77. data/lib/courgette/feature.rb +52 -0
  78. data/lib/courgette.rb +29 -0
  79. data/script/console +10 -0
  80. data/script/destroy +14 -0
  81. data/script/generate +14 -0
  82. data/spec/controllers/features_controller_spec.rb +24 -0
  83. data/spec/courgette_spec.rb +25 -0
  84. data/spec/feature_spec.rb +33 -0
  85. data/spec/spec_helper.rb +19 -0
  86. data/test/test_courgette.rb +11 -0
  87. data/test/test_helper.rb +3 -0
  88. metadata +164 -0
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2009-07-21
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,87 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ app/controllers/features_controller.rb
7
+ app/views/features/index.html.erb
8
+ app/views/features/show.html.erb
9
+ app/views/layouts/courgette.html.erb
10
+ config/routes.rb
11
+ courgette.gemspec
12
+ features/list_features.feature
13
+ features/show_feature.feature
14
+ features/step_definitions/courgette_steps.rb
15
+ features/step_definitions/webrat_steps.rb
16
+ features/support/env.rb
17
+ fixture_rails_root/README
18
+ fixture_rails_root/Rakefile
19
+ fixture_rails_root/app/controllers/application_controller.rb
20
+ fixture_rails_root/app/helpers/application_helper.rb
21
+ fixture_rails_root/app/views/home/index.html.erb
22
+ fixture_rails_root/app/views/layouts/application.html.erb
23
+ fixture_rails_root/config/boot.rb
24
+ fixture_rails_root/config/database.yml
25
+ fixture_rails_root/config/environment.rb
26
+ fixture_rails_root/config/environments/development.rb
27
+ fixture_rails_root/config/environments/production.rb
28
+ fixture_rails_root/config/environments/test.rb
29
+ fixture_rails_root/config/initializers/backtrace_silencers.rb
30
+ fixture_rails_root/config/initializers/inflections.rb
31
+ fixture_rails_root/config/initializers/mime_types.rb
32
+ fixture_rails_root/config/initializers/new_rails_defaults.rb
33
+ fixture_rails_root/config/initializers/session_store.rb
34
+ fixture_rails_root/config/locales/en.yml
35
+ fixture_rails_root/config/routes.rb
36
+ fixture_rails_root/db/development.sqlite3
37
+ fixture_rails_root/db/migrate/20090720193349_add_users.rb
38
+ fixture_rails_root/db/schema.rb
39
+ fixture_rails_root/db/test.sqlite3
40
+ fixture_rails_root/doc/README_FOR_APP
41
+ fixture_rails_root/features/step_definitions/webrat_steps.rb
42
+ fixture_rails_root/features/support/env.rb
43
+ fixture_rails_root/features/support/paths.rb
44
+ fixture_rails_root/features/user_eats_rabbits.feature
45
+ fixture_rails_root/features/visitor_transforms.feature
46
+ fixture_rails_root/lib/tasks/cucumber.rake
47
+ fixture_rails_root/public/404.html
48
+ fixture_rails_root/public/422.html
49
+ fixture_rails_root/public/500.html
50
+ fixture_rails_root/public/favicon.ico
51
+ fixture_rails_root/public/images/rails.png
52
+ fixture_rails_root/public/index.html
53
+ fixture_rails_root/public/javascripts/application.js
54
+ fixture_rails_root/public/javascripts/controls.js
55
+ fixture_rails_root/public/javascripts/dragdrop.js
56
+ fixture_rails_root/public/javascripts/effects.js
57
+ fixture_rails_root/public/javascripts/prototype.js
58
+ fixture_rails_root/public/robots.txt
59
+ fixture_rails_root/script/about
60
+ fixture_rails_root/script/console
61
+ fixture_rails_root/script/cucumber
62
+ fixture_rails_root/script/dbconsole
63
+ fixture_rails_root/script/destroy
64
+ fixture_rails_root/script/generate
65
+ fixture_rails_root/script/performance/benchmarker
66
+ fixture_rails_root/script/performance/profiler
67
+ fixture_rails_root/script/plugin
68
+ fixture_rails_root/script/runner
69
+ fixture_rails_root/script/server
70
+ fixture_rails_root/spec/controllers/home_controller_spec.rb
71
+ fixture_rails_root/spec/helpers/home_helper_spec.rb
72
+ fixture_rails_root/spec/views/home/index.html.erb_spec.rb
73
+ fixture_rails_root/test/fixtures/users.yml
74
+ fixture_rails_root/test/performance/browsing_test.rb
75
+ fixture_rails_root/test/test_helper.rb
76
+ fixture_rails_root/test/unit/user_test.rb
77
+ lib/courgette.rb
78
+ lib/courgette/feature.rb
79
+ script/console
80
+ script/destroy
81
+ script/generate
82
+ spec/controllers/features_controller_spec.rb
83
+ spec/courgette_spec.rb
84
+ spec/feature_spec.rb
85
+ spec/spec_helper.rb
86
+ test/test_courgette.rb
87
+ test/test_helper.rb
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on courgette, see http://courgette.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.rdoc ADDED
@@ -0,0 +1,53 @@
1
+ = courgette
2
+
3
+ * http://github.com/jnicklas/courgette
4
+
5
+ == DESCRIPTION:
6
+
7
+ Courgette is a Rails engine which makes your feature files viewable through
8
+ your browser. Install and browse to:
9
+
10
+ /features
11
+
12
+ Voilá, pretty list of features. Great for communicating with the customer.
13
+
14
+ == FEATURES/PROBLEMS:
15
+
16
+ * FIX (list of features or problems)
17
+
18
+ == SYNOPSIS:
19
+
20
+ FIX (code sample of usage)
21
+
22
+ == REQUIREMENTS:
23
+
24
+ * FIX (list of requirements)
25
+
26
+ == INSTALL:
27
+
28
+ * FIX (sudo gem install, anything else)
29
+
30
+ == LICENSE:
31
+
32
+ (The MIT License)
33
+
34
+ Copyright (c) 2009 Jonas Nicklas
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining
37
+ a copy of this software and associated documentation files (the
38
+ 'Software'), to deal in the Software without restriction, including
39
+ without limitation the rights to use, copy, modify, merge, publish,
40
+ distribute, sublicense, and/or sell copies of the Software, and to
41
+ permit persons to whom the Software is furnished to do so, subject to
42
+ the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be
45
+ included in all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
48
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
50
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
51
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
52
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
53
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/courgette'
6
+
7
+ Hoe.plugin :newgem
8
+ # Hoe.plugin :website
9
+ Hoe.plugin :cucumberfeatures
10
+
11
+ # Generate all the Rake tasks
12
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
13
+ $hoe = Hoe.spec 'courgette' do
14
+ self.developer 'Jonas Nicklas', 'jonas.nicklas@gmail.com'
15
+ self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
16
+ self.rubyforge_name = self.name # TODO this is default value
17
+ self.version = Courgette::VERSION
18
+ self.extra_deps = [['cucumber','>= 0.3.90']]
19
+
20
+ end
21
+
22
+ require 'newgem/tasks'
23
+ Dir['tasks/**/*.rake'].each { |t| load t }
24
+
25
+ # TODO - want other tests/tasks run by default? Add them to the list
26
+ # remove_task :default
27
+ # task :default => [:spec, :features]
@@ -0,0 +1,14 @@
1
+ class FeaturesController < ApplicationController
2
+ unloadable
3
+
4
+ layout "courgette"
5
+
6
+ def index
7
+ @features = Courgette.features
8
+ end
9
+
10
+ def show
11
+ @feature = Courgette.find(params[:id])
12
+ end
13
+
14
+ end
@@ -0,0 +1,19 @@
1
+ <h1>Features</h1>
2
+
3
+ <table id="features" border="0" cellspacing="0" cellpadding="0">
4
+ <thead>
5
+ <tr>
6
+ <th>Name</th>
7
+ <th>Scenarios</th>
8
+ </tr>
9
+ </thead>
10
+
11
+ <tbody>
12
+ <% @features.each do |feature| %>
13
+ <tr>
14
+ <td><%= link_to feature.name, feature_path(feature) %></td>
15
+ <td><%= feature.feature_elements_size %></td>
16
+ </tr>
17
+ <% end %>
18
+ </tbody>
19
+ </table>
@@ -0,0 +1,3 @@
1
+ <%= @feature.to_html %>
2
+
3
+ <p class="return"><%= link_to '&laquo; Return to list', features_path %></p>
@@ -0,0 +1,94 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
7
+ <title>Features</title>
8
+
9
+ <style type="text/css" media="screen">
10
+ body {
11
+ background: #f0f0f0;
12
+ font-family: 'Lucida Sans Unicode','Lucida Grande',sans-serif;
13
+ font-size: 13px;
14
+ line-height: 1.5em;
15
+ }
16
+
17
+ * {
18
+ margin: 0;
19
+ padding: 0;
20
+ }
21
+
22
+ a:link, a:visited {
23
+ border-bottom: 1px solid #98c4d1;
24
+ color: #359abe;
25
+ text-decoration: none;
26
+ }
27
+
28
+ a:hover {
29
+ border-bottom: 1px solid #c63;
30
+ color: #c63;
31
+ }
32
+
33
+ #page {
34
+ margin: 30px 200px 100px 50px;
35
+ background: white;
36
+ border-bottom: 3px solid #ccc;
37
+ border-right: 3px solid #ddd;
38
+ padding: 30px 50px 60px;
39
+ }
40
+
41
+ #page h1, #page h2, #page h3 {
42
+ font-weight: normal;
43
+ }
44
+
45
+ #features {
46
+ width: 100%;
47
+ margin: 1em 0 3em;
48
+ }
49
+
50
+ #features th {
51
+ text-align: left;
52
+ background: #eee;
53
+ border-bottom: 4px solid #ccc;
54
+ padding: 5px 10px;
55
+ }
56
+
57
+ #features td {
58
+ border-bottom: 1px solid #ccc;
59
+ padding: 10px 10px;
60
+ }
61
+
62
+ .narrative {
63
+ border: 1px solid #ddd;
64
+ padding: 10px;
65
+ color: #888;
66
+ margin: 1em 0;
67
+ }
68
+
69
+ .scenario h3, .background h3 {
70
+ margin: 0 0 1em;
71
+ }
72
+
73
+ .scenario, .background {
74
+ border: 1px solid #ddd;
75
+ margin: 1em 0;
76
+ padding: 10px;
77
+ }
78
+
79
+ .scenario li, .background li {
80
+ list-style: none;
81
+ }
82
+
83
+ .keyword {
84
+ color: #DC7D11;
85
+ }
86
+ </style>
87
+ </head>
88
+
89
+ <body>
90
+ <div id="page">
91
+ <%= yield %>
92
+ </div>
93
+ </body>
94
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ map.resources :features, :only => %w(index show)
3
+ end
data/courgette.gemspec ADDED
@@ -0,0 +1,44 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{courgette}
5
+ s.version = "0.0.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jonas Nicklas"]
9
+ s.date = %q{2009-07-22}
10
+ s.description = %q{Courgette is a Rails engine which makes your feature files viewable through
11
+ your browser. Install and browse to:
12
+
13
+ /features
14
+
15
+ Voilá, pretty list of features. Great for communicating with the customer.}
16
+ s.email = ["jonas.nicklas@gmail.com"]
17
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "fixture_rails_root/public/robots.txt"]
18
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app/controllers/features_controller.rb", "app/views/features/index.html.erb", "app/views/features/show.html.erb", "app/views/layouts/courgette.html.erb", "config/routes.rb", "courgette.gemspec", "features/list_features.feature", "features/show_feature.feature", "features/step_definitions/courgette_steps.rb", "features/step_definitions/webrat_steps.rb", "features/support/env.rb", "fixture_rails_root/README", "fixture_rails_root/Rakefile", "fixture_rails_root/app/controllers/application_controller.rb", "fixture_rails_root/app/helpers/application_helper.rb", "fixture_rails_root/app/views/home/index.html.erb", "fixture_rails_root/app/views/layouts/application.html.erb", "fixture_rails_root/config/boot.rb", "fixture_rails_root/config/database.yml", "fixture_rails_root/config/environment.rb", "fixture_rails_root/config/environments/development.rb", "fixture_rails_root/config/environments/production.rb", "fixture_rails_root/config/environments/test.rb", "fixture_rails_root/config/initializers/backtrace_silencers.rb", "fixture_rails_root/config/initializers/inflections.rb", "fixture_rails_root/config/initializers/mime_types.rb", "fixture_rails_root/config/initializers/new_rails_defaults.rb", "fixture_rails_root/config/initializers/session_store.rb", "fixture_rails_root/config/locales/en.yml", "fixture_rails_root/config/routes.rb", "fixture_rails_root/db/development.sqlite3", "fixture_rails_root/db/migrate/20090720193349_add_users.rb", "fixture_rails_root/db/schema.rb", "fixture_rails_root/db/test.sqlite3", "fixture_rails_root/doc/README_FOR_APP", "fixture_rails_root/features/step_definitions/webrat_steps.rb", "fixture_rails_root/features/support/env.rb", "fixture_rails_root/features/support/paths.rb", "fixture_rails_root/features/user_eats_rabbits.feature", "fixture_rails_root/features/visitor_transforms.feature", "fixture_rails_root/lib/tasks/cucumber.rake", "fixture_rails_root/public/404.html", "fixture_rails_root/public/422.html", "fixture_rails_root/public/500.html", "fixture_rails_root/public/favicon.ico", "fixture_rails_root/public/images/rails.png", "fixture_rails_root/public/index.html", "fixture_rails_root/public/javascripts/application.js", "fixture_rails_root/public/javascripts/controls.js", "fixture_rails_root/public/javascripts/dragdrop.js", "fixture_rails_root/public/javascripts/effects.js", "fixture_rails_root/public/javascripts/prototype.js", "fixture_rails_root/public/robots.txt", "fixture_rails_root/script/about", "fixture_rails_root/script/console", "fixture_rails_root/script/cucumber", "fixture_rails_root/script/dbconsole", "fixture_rails_root/script/destroy", "fixture_rails_root/script/generate", "fixture_rails_root/script/performance/benchmarker", "fixture_rails_root/script/performance/profiler", "fixture_rails_root/script/plugin", "fixture_rails_root/script/runner", "fixture_rails_root/script/server", "fixture_rails_root/spec/controllers/home_controller_spec.rb", "fixture_rails_root/spec/helpers/home_helper_spec.rb", "fixture_rails_root/spec/views/home/index.html.erb_spec.rb", "fixture_rails_root/test/fixtures/users.yml", "fixture_rails_root/test/performance/browsing_test.rb", "fixture_rails_root/test/test_helper.rb", "fixture_rails_root/test/unit/user_test.rb", "lib/courgette.rb", "lib/courgette/feature.rb", "script/console", "script/destroy", "script/generate", "spec/controllers/features_controller_spec.rb", "spec/courgette_spec.rb", "spec/feature_spec.rb", "spec/spec_helper.rb", "test/test_courgette.rb", "test/test_helper.rb"]
19
+ s.has_rdoc = true
20
+ s.homepage = %q{http://github.com/jnicklas/courgette}
21
+ s.post_install_message = %q{PostInstall.txt}
22
+ s.rdoc_options = ["--main", "README.rdoc"]
23
+ s.require_paths = ["lib"]
24
+ s.rubyforge_project = %q{courgette}
25
+ s.rubygems_version = %q{1.3.2}
26
+ s.summary = %q{Courgette is a Rails engine which makes your feature files viewable through your browser}
27
+ s.test_files = ["test/test_courgette.rb", "test/test_helper.rb"]
28
+
29
+ if s.respond_to? :specification_version then
30
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
31
+ s.specification_version = 3
32
+
33
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
34
+ s.add_runtime_dependency(%q<cucumber>, [">= 0.3.90"])
35
+ s.add_development_dependency(%q<hoe>, [">= 2.3.2"])
36
+ else
37
+ s.add_dependency(%q<cucumber>, [">= 0.3.90"])
38
+ s.add_dependency(%q<hoe>, [">= 2.3.2"])
39
+ end
40
+ else
41
+ s.add_dependency(%q<cucumber>, [">= 0.3.90"])
42
+ s.add_dependency(%q<hoe>, [">= 2.3.2"])
43
+ end
44
+ end
@@ -0,0 +1,11 @@
1
+ Feature: List features
2
+ In order to communicate the function of the application to the customer
3
+ As a developer using cucumber
4
+ I want to publish a list of features for my application
5
+
6
+ Scenario: list features in the fixture application
7
+ Given I enter the address of the feature page
8
+
9
+ Then I should see a table with the headers "Name, Scenarios"
10
+ Then I should see a table where a row contains the cells "User eats a Rabbit, 2"
11
+ Then I should see a table where a row contains the cells "Visitor can transform into a tamagochi, 1"
@@ -0,0 +1,23 @@
1
+ Feature: List features
2
+ In order to communicate the function of the application to the customer
3
+ As a developer using cucumber
4
+ I want to publish a feature
5
+
6
+ Scenario: list features in the fixture application
7
+ Given I enter the address of the feature page
8
+
9
+ Then I should see a table with the headers "Name, Scenarios"
10
+ Then I should see a table where a row contains the cells "User eats a Rabbit, 2"
11
+
12
+ When I follow "User eats a Rabbit"
13
+
14
+ Then I should see the header "Feature: User eats a Rabbit"
15
+
16
+ And I should see "In order to get that delicious feeling"
17
+ And I should see "As a user"
18
+ And I should see "I want to eat some Rabbits"
19
+ And I should see "Scenario: eat a really cute rabbit"
20
+ And I should see "Given there is a rabbit"
21
+ And I should see "And the rabbit is really cute"
22
+ And I should see "When I eat the rabbit"
23
+ And I should see "Then I should feel good"
@@ -0,0 +1,25 @@
1
+ Then /^I should see the header "([^\"]*)"$/ do |header|
2
+ response.should have_tag('h1,h2', :text => /#{header}/)
3
+ end
4
+
5
+ Then /^I should see a table where a row contains the cells? "([^\"]*)"$/ do |cells|
6
+ response.should have_tag('table') do |table|
7
+ table.should have_tag('tr') do |tr|
8
+ cells.split(/\s*,\s*/).each do |cell|
9
+ tr.should have_tag('td,th', :text => /#{Regexp.escape(cell)}/)
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ Then /^I should see a table with the headers "([^\"]*)"$/ do |headers|
16
+ response.should have_tag('table') do |table|
17
+ headers.split(/\s*,\s*/).each do |header|
18
+ table.should have_tag('th', :text => /#{Regexp.escape(header)}/)
19
+ end
20
+ end
21
+ end
22
+
23
+ Given /^I enter the address of the feature page$/ do
24
+ visit '/features'
25
+ end
@@ -0,0 +1,104 @@
1
+ # Commonly used webrat steps
2
+ # http://github.com/brynary/webrat
3
+ When /^I press "([^\"]*)"$/ do |button|
4
+ click_button(button)
5
+ end
6
+
7
+ When /^I follow "([^\"]*)"$/ do |link|
8
+ click_link(link)
9
+ end
10
+
11
+ When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
12
+ fill_in(field, :with => value)
13
+ end
14
+
15
+ When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
16
+ select(value, :from => field)
17
+ end
18
+
19
+ # Use this step in conjunction with Rail's datetime_select helper. For example:
20
+ # When I select "December 25, 2008 10:00" as the date and time
21
+ When /^I select "([^\"]*)" as the date and time$/ do |time|
22
+ select_datetime(time)
23
+ end
24
+
25
+ # Use this step when using multiple datetime_select helpers on a page or
26
+ # you want to specify which datetime to select. Given the following view:
27
+ # <%= f.label :preferred %><br />
28
+ # <%= f.datetime_select :preferred %>
29
+ # <%= f.label :alternative %><br />
30
+ # <%= f.datetime_select :alternative %>
31
+ # The following steps would fill out the form:
32
+ # When I select "November 23, 2004 11:20" as the "Preferred" data and time
33
+ # And I select "November 25, 2004 10:30" as the "Alternative" data and time
34
+ When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
35
+ select_datetime(datetime, :from => datetime_label)
36
+ end
37
+
38
+ # Use this step in conjunction with Rail's time_select helper. For example:
39
+ # When I select "2:20PM" as the time
40
+ # Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
41
+ # will convert the 2:20PM to 14:20 and then select it.
42
+ When /^I select "([^\"]*)" as the time$/ do |time|
43
+ select_time(time)
44
+ end
45
+
46
+ # Use this step when using multiple time_select helpers on a page or you want to
47
+ # specify the name of the time on the form. For example:
48
+ # When I select "7:30AM" as the "Gym" time
49
+ When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
50
+ select_time(time, :from => time_label)
51
+ end
52
+
53
+ # Use this step in conjunction with Rail's date_select helper. For example:
54
+ # When I select "February 20, 1981" as the date
55
+ When /^I select "([^\"]*)" as the date$/ do |date|
56
+ select_date(date)
57
+ end
58
+
59
+ # Use this step when using multiple date_select helpers on one page or
60
+ # you want to specify the name of the date on the form. For example:
61
+ # When I select "April 26, 1982" as the "Date of Birth" date
62
+ When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
63
+ select_date(date, :from => date_label)
64
+ end
65
+
66
+ When /^I check "([^\"]*)"$/ do |field|
67
+ check(field)
68
+ end
69
+
70
+ When /^I uncheck "([^\"]*)"$/ do |field|
71
+ uncheck(field)
72
+ end
73
+
74
+ When /^I choose "([^\"]*)"$/ do |field|
75
+ choose(field)
76
+ end
77
+
78
+ When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
79
+ attach_file(field, path)
80
+ end
81
+
82
+ Then /^I should see "([^\"]*)"$/ do |text|
83
+ response.should contain(text)
84
+ end
85
+
86
+ Then /^I should not see "([^\"]*)"$/ do |text|
87
+ response.should_not contain(text)
88
+ end
89
+
90
+ Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
91
+ field_labeled(field).value.should =~ /#{value}/
92
+ end
93
+
94
+ Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
95
+ field_labeled(field).value.should_not =~ /#{value}/
96
+ end
97
+
98
+ Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
99
+ field_labeled(label).should be_checked
100
+ end
101
+
102
+ Then /^I should be on (.+)$/ do |page_name|
103
+ URI.parse(current_url).path.should == path_to(page_name)
104
+ end
@@ -0,0 +1,23 @@
1
+ ## this file is just for bootstrapping tests, it won't actually be generated!
2
+
3
+ ENV["RAILS_ENV"] = "test"
4
+ RAILS_ENV = ENV["RAILS_ENV"]
5
+
6
+ require 'rubygems'
7
+
8
+ require File.expand_path(File.dirname(__FILE__) + "/../../fixture_rails_root/config/environment")
9
+
10
+ require 'cucumber/rails/world'
11
+ require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
12
+ Cucumber::Rails.use_transactional_fixtures
13
+ Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
14
+ # (e.g. rescue_action_in_public / rescue_responses / rescue_from)
15
+
16
+ require 'webrat'
17
+
18
+ Webrat.configure do |config|
19
+ config.mode = :rails
20
+ end
21
+
22
+ require 'cucumber/rails/rspec'
23
+ require 'webrat/core/matchers'