jnicklas-courgette 0.0.2 → 0.0.3

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.
data/Manifest.txt CHANGED
@@ -4,7 +4,6 @@ PostInstall.txt
4
4
  README.rdoc
5
5
  Rakefile
6
6
  app/controllers/features_controller.rb
7
- app/views/features/index.html.erb
8
7
  app/views/features/show.html.erb
9
8
  app/views/layouts/courgette.html.erb
10
9
  config/routes.rb
@@ -83,5 +82,3 @@ spec/controllers/features_controller_spec.rb
83
82
  spec/courgette_spec.rb
84
83
  spec/feature_spec.rb
85
84
  spec/spec_helper.rb
86
- test/test_courgette.rb
87
- test/test_helper.rb
data/Rakefile CHANGED
@@ -24,4 +24,4 @@ Dir['tasks/**/*.rake'].each { |t| load t }
24
24
 
25
25
  # TODO - want other tests/tasks run by default? Add them to the list
26
26
  # remove_task :default
27
- # task :default => [:spec, :features]
27
+ task :default => [:spec, :features]
@@ -4,7 +4,8 @@ class FeaturesController < ApplicationController
4
4
  layout "courgette"
5
5
 
6
6
  def index
7
- @features = Courgette.features
7
+ @feature = Courgette.first
8
+ render "show"
8
9
  end
9
10
 
10
11
  def show
@@ -1,3 +1 @@
1
- <%= @feature.to_html %>
2
-
3
- <p class="return"><%= link_to '&laquo; Return to list', features_path %></p>
1
+ <%= @feature.to_html %>
@@ -30,38 +30,59 @@
30
30
  color: #c63;
31
31
  }
32
32
 
33
+ #menu {
34
+ width: 259px;
35
+ margin-right: -300px;
36
+ float: left;
37
+ margin: 100px 0 10px 40px;
38
+ list-style: none;
39
+ padding: 40px 0 60px;
40
+ border-right: 1px solid #eee;
41
+ }
42
+
43
+ #menu li a {
44
+ display: block;
45
+ padding: 5px 20px;
46
+ border-bottom: 1px solid #ddd;
47
+ border-top: 1px solid #ddd;
48
+ }
49
+
50
+ #menu li a.current {
51
+ border-left: 5px solid #c63;
52
+ padding-left: 15px;
53
+ }
54
+
55
+ #footer {
56
+ margin: 10px 50px 100px 300px;
57
+ color: #888;
58
+ }
59
+
33
60
  #page {
34
- margin: 30px 200px 100px 50px;
61
+ margin: 30px 50px 10px 300px;
35
62
  background: white;
36
63
  border-bottom: 3px solid #ccc;
37
64
  border-right: 3px solid #ddd;
38
65
  padding: 30px 50px 60px;
66
+ min-height: 600px;
39
67
  }
40
68
 
41
69
  #page h1, #page h2, #page h3 {
42
70
  font-weight: normal;
71
+ font-size: 1em;
43
72
  }
44
73
 
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;
74
+ #page h2 {
75
+ background: #F4FDFF;
76
+ font-family: "Museo700","Helvetica Neue",Arial,sans-serif;
77
+ font-size: 26px;
78
+ color: #4B96AE;
79
+ margin: -30px -50px 40px;
80
+ padding: 20px 50px 0;
81
+ height: 39px;
82
+ border-bottom: 1px solid #E3EDEF;
60
83
  }
61
84
 
62
85
  .narrative {
63
- border: 1px solid #ddd;
64
- padding: 10px;
65
86
  color: #888;
66
87
  margin: 1em 0;
67
88
  }
@@ -70,10 +91,8 @@
70
91
  margin: 0 0 1em;
71
92
  }
72
93
 
73
- .scenario, .background {
74
- border: 1px solid #ddd;
75
- margin: 1em 0;
76
- padding: 10px;
94
+ .scenario, .background, .narrative {
95
+ margin: 3em 0;
77
96
  }
78
97
 
79
98
  .scenario li, .background li {
@@ -83,12 +102,28 @@
83
102
  .keyword {
84
103
  color: #DC7D11;
85
104
  }
105
+
106
+ li .keyword {
107
+ float: left;
108
+ width: 55px;
109
+ text-align: right;
110
+ margin-right: 1em;
111
+ }
86
112
  </style>
87
113
  </head>
88
114
 
89
115
  <body>
116
+ <ul id="menu">
117
+ <% Courgette.features.each do |feature| %>
118
+ <li><%= link_to truncate(feature.name, :length => 35), feature_path(feature), :title => feature.name, :class => (feature == @feature) ? 'current' : '' %></li>
119
+ <% end %>
120
+ </ul>
90
121
  <div id="page">
91
122
  <%= yield %>
92
123
  </div>
124
+ <div id="footer">
125
+ Powered by <%= link_to 'Courgette', 'http://github.com/jnicklas/courgette' %>,
126
+ an open cource viewer for <%= link_to 'Cucumber', 'http://cukes.info' %> features.
127
+ </div>
93
128
  </body>
94
129
  </html>
data/courgette.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{courgette}
5
- s.version = "0.0.2"
5
+ s.version = "0.0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jonas Nicklas"]
9
- s.date = %q{2009-07-22}
9
+ s.date = %q{2009-07-24}
10
10
  s.description = %q{Courgette is a Rails engine which makes your feature files viewable through
11
11
  your browser. Install and browse to:
12
12
 
@@ -15,7 +15,7 @@ your browser. Install and browse to:
15
15
  Voilá, pretty list of features. Great for communicating with the customer.}
16
16
  s.email = ["jonas.nicklas@gmail.com"]
17
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"]
18
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "app/controllers/features_controller.rb", "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"]
19
19
  s.has_rdoc = true
20
20
  s.homepage = %q{http://github.com/jnicklas/courgette}
21
21
  s.post_install_message = %q{PostInstall.txt}
@@ -24,7 +24,6 @@ Voilá, pretty list of features. Great for communicating with the customer.}
24
24
  s.rubyforge_project = %q{courgette}
25
25
  s.rubygems_version = %q{1.3.2}
26
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
27
 
29
28
  if s.respond_to? :specification_version then
30
29
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -6,6 +6,5 @@ Feature: List features
6
6
  Scenario: list features in the fixture application
7
7
  Given I enter the address of the feature page
8
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"
9
+ Then I should see "User eats a Rabbit"
10
+ Then I should see "Visitor can transform"
@@ -6,8 +6,7 @@ Feature: List features
6
6
  Scenario: list features in the fixture application
7
7
  Given I enter the address of the feature page
8
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"
9
+ Then I should see "User eats a Rabbit"
11
10
 
12
11
  When I follow "User eats a Rabbit"
13
12
 
@@ -1,25 +1,25 @@
1
1
  module Courgette
2
-
2
+
3
3
  class Feature
4
-
4
+
5
5
  attr_reader :path
6
-
6
+
7
7
  def initialize(path)
8
8
  @path = path
9
9
  end
10
-
10
+
11
11
  def name
12
- name_lines.first.split(':', 2).second.strip
12
+ File.read(@path).to_s[/^Feature: (.+)$/, 1] || name_lines.first.split(':', 2).second.strip
13
13
  end
14
-
14
+
15
15
  def feature_elements_size
16
16
  ast.instance_variable_get('@feature_elements').size
17
17
  end
18
-
18
+
19
19
  def to_param
20
20
  relative_path.sub(/^\//, '').sub(/\.feature$/, '').parameterize.dasherize.to_s
21
21
  end
22
-
22
+
23
23
  def to_html
24
24
  step_mother = Object.new
25
25
  step_mother.extend(Cucumber::StepMother)
@@ -27,12 +27,16 @@ module Courgette
27
27
  visitor.visit_feature(ast)
28
28
  end
29
29
 
30
+ def ==(other)
31
+ to_param == other.to_param
32
+ end
33
+
30
34
  private
31
-
35
+
32
36
  def relative_path
33
37
  File.expand_path(path).sub(Courgette.feature_root, '')
34
38
  end
35
-
39
+
36
40
  def name_lines
37
41
  ast.name.respond_to?(:lines) ? ast.name.lines.to_a : ast.name.to_a
38
42
  end
@@ -40,13 +44,11 @@ module Courgette
40
44
  def feature_file
41
45
  @feature_file ||= Cucumber::FeatureFile.new(path)
42
46
  end
43
-
47
+
44
48
  def ast
45
49
  @ast ||= feature_file.parse
46
50
  end
47
-
48
-
51
+
49
52
  end
50
-
51
-
52
- end
53
+
54
+ end
data/lib/courgette.rb CHANGED
@@ -6,7 +6,7 @@ require 'cucumber/feature_file'
6
6
  require 'cucumber/formatter/html'
7
7
 
8
8
  module Courgette
9
- VERSION = '0.0.2'
9
+ VERSION = '0.0.3'
10
10
 
11
11
  autoload :Feature, 'courgette/feature'
12
12
 
@@ -17,6 +17,10 @@ module Courgette
17
17
  end
18
18
  end
19
19
 
20
+ def first
21
+ features.first
22
+ end
23
+
20
24
  def find(param)
21
25
  features.find { |f| f.to_param == param }
22
26
  end
@@ -24,6 +28,5 @@ module Courgette
24
28
  def feature_root
25
29
  Rails.root.join('features').to_s
26
30
  end
27
-
28
31
  end
29
32
  end
@@ -13,12 +13,11 @@ describe FeaturesController do
13
13
  end
14
14
 
15
15
  describe :get => :index do
16
- before { Rails.stub!(:root).and_return('rails/root') }
17
- before { Courgette.should_receive(:features).and_return([@feature]) }
16
+ before { Courgette.should_receive(:first).and_return(@feature) }
18
17
 
19
18
  it { should respond_with(:success) }
20
- it { should render_template('features/index') }
21
- it { should assign_to(:features, :with => [@feature]) }
19
+ it { should render_template('features/show') }
20
+ it { should assign_to(:feature, :with => @feature) }
22
21
  end
23
22
 
24
23
  end
@@ -22,4 +22,10 @@ describe Courgette do
22
22
  end
23
23
  end
24
24
 
25
+ describe '.first' do
26
+ it "should return the first feature" do
27
+ Courgette.first.should == Courgette.features.first
28
+ end
29
+ end
30
+
25
31
  end
data/spec/feature_spec.rb CHANGED
@@ -25,8 +25,21 @@ describe Courgette::Feature do
25
25
  end
26
26
 
27
27
  describe '#to_html' do
28
- it "should not raise any errors" do
29
- lambda { @feature.to_html }.should_not raise_error
28
+ it "should contain the feature text" do
29
+ @feature.to_html.should include('In order to get that delicious feeling')
30
+ @feature.to_html.should include('As a user')
31
+ @feature.to_html.should include('I want to eat some Rabbits')
32
+ @feature.to_html.should include('eat a really cute rabbit')
33
+ @feature.to_html.should include('there is a rabbit')
34
+ @feature.to_html.should include('the rabbit is really cute')
35
+ @feature.to_html.should include('eat the rabbit')
36
+ @feature.to_html.should include('should feel good')
37
+ end
38
+ end
39
+
40
+ describe '#==' do
41
+ it "should be equal if it has the same param" do
42
+ @feature.should == Courgette::Feature.new(Rails.root.join('features/user_eats_rabbits.feature').to_s)
30
43
  end
31
44
  end
32
45
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnicklas-courgette
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-22 00:00:00 -07:00
12
+ date: 2009-07-24 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -51,7 +51,6 @@ files:
51
51
  - README.rdoc
52
52
  - Rakefile
53
53
  - app/controllers/features_controller.rb
54
- - app/views/features/index.html.erb
55
54
  - app/views/features/show.html.erb
56
55
  - app/views/layouts/courgette.html.erb
57
56
  - config/routes.rb
@@ -130,8 +129,6 @@ files:
130
129
  - spec/courgette_spec.rb
131
130
  - spec/feature_spec.rb
132
131
  - spec/spec_helper.rb
133
- - test/test_courgette.rb
134
- - test/test_helper.rb
135
132
  has_rdoc: true
136
133
  homepage: http://github.com/jnicklas/courgette
137
134
  post_install_message: PostInstall.txt
@@ -159,6 +156,5 @@ rubygems_version: 1.2.0
159
156
  signing_key:
160
157
  specification_version: 3
161
158
  summary: Courgette is a Rails engine which makes your feature files viewable through your browser
162
- test_files:
163
- - test/test_courgette.rb
164
- - test/test_helper.rb
159
+ test_files: []
160
+
@@ -1,19 +0,0 @@
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>
@@ -1,11 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestCourgette < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_truth
9
- assert true
10
- end
11
- end
data/test/test_helper.rb DELETED
@@ -1,3 +0,0 @@
1
- require 'stringio'
2
- require 'test/unit'
3
- require File.dirname(__FILE__) + '/../lib/courgette'