shakespeare 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/README.md +85 -0
  2. data/Rakefile +43 -0
  3. data/app/controllers/admin/pages_controller.rb +47 -0
  4. data/app/controllers/pages_controller.rb +5 -0
  5. data/app/models/page.rb +10 -0
  6. data/app/views/admin/pages/_form.html.erb +38 -0
  7. data/app/views/admin/pages/edit.html.erb +3 -0
  8. data/app/views/admin/pages/index.html.erb +24 -0
  9. data/app/views/admin/pages/new.html.erb +3 -0
  10. data/app/views/layouts/admin.html.erb +9 -0
  11. data/app/views/pages/show.html.erb +3 -0
  12. data/config/cucumber.yml +7 -0
  13. data/config/routes.rb +8 -0
  14. data/features/admin_pages.feature +38 -0
  15. data/features/public_pages.feature +12 -0
  16. data/features/step_definitions/page_steps.rb +7 -0
  17. data/features/step_definitions/web_steps.rb +259 -0
  18. data/features/support/env.rb +55 -0
  19. data/features/support/paths.rb +32 -0
  20. data/features/support/shakespeare_env.rb +3 -0
  21. data/generators/definition.txt +0 -0
  22. data/generators/shakespeare/USAGE +5 -0
  23. data/generators/shakespeare/shakespeare_generator.rb +8 -0
  24. data/generators/shakespeare/templates/20091230095600_create_pages.rb +25 -0
  25. data/lib/shakespeare.rb +7 -0
  26. data/lib/shakespeare/helpers.rb +16 -0
  27. data/lib/shakespeare/settings.rb +30 -0
  28. data/lib/shakespeare/shakespeare.rb +8 -0
  29. data/lib/shakespeare/view_helpers.rb +29 -0
  30. data/rails/init.rb +1 -0
  31. data/rerun.txt +1 -0
  32. data/spec/blueprints.rb +9 -0
  33. data/spec/controllers/admin/pages_controller_spec.rb +35 -0
  34. data/spec/database.yml +21 -0
  35. data/spec/debug.log +1937 -0
  36. data/spec/helpers_spec.rb +19 -0
  37. data/spec/models/page_spec.rb +28 -0
  38. data/spec/schema.rb +16 -0
  39. data/spec/shakespeare_generator_spec.rb +36 -0
  40. data/spec/shakespeare_spec.rb +3 -0
  41. data/spec/spec_helper.rb +41 -0
  42. data/spec/view_helpers_spec.rb +103 -0
  43. metadata +104 -0
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ Shakespeare
2
+ ===========
3
+
4
+ Shakespeare is a Ruby on Rails content manager plugin.
5
+
6
+ Shakespeare allows:
7
+
8
+ - User-editable page titles, descriptions, meta info and content blocks for dynamic requests
9
+ - User editable content-only pages
10
+
11
+ Shakespeare is a super simple bolt-on CMS for any Rails app.
12
+
13
+ Installation
14
+ ============
15
+
16
+ Shakespeare is easy to install.
17
+
18
+ As a plugin:
19
+
20
+ ./script/plugin install git://github.com/paulca/shakespeare.git
21
+
22
+ Or as a gem. Add this to your environment.rb:
23
+
24
+ config.gem 'shakespeare'
25
+
26
+ Then generate the migration to create the pages table:
27
+
28
+ ./script/generate shakespeare
29
+
30
+ And run the migration:
31
+
32
+ rake db:migrate
33
+
34
+ Basic Usage
35
+ ===========
36
+
37
+ Once Shakespeare is installed, every controller action can now have its own content. You an access this content in the controller or the view with the `page_content` method.
38
+
39
+ View Helpers
40
+ ============
41
+
42
+ In your views, you have access to a number of helpers for generating your page meta-data.
43
+
44
+ - `page_title` is the title of the page
45
+ - `keywords_meta_tag` generates a <meta> tag for the page keywords, or returns nil if it's left blank
46
+ - `description_meta_tag` generates a <meta> tag for the page description, or returns nil if it's left blank
47
+ - `robots_meta_tag` generates a <meta> tag for the robots no-index and/or nofollow meta tag options, or returns nil if it's left blank
48
+ - `canonical_link_tag` generates a <link> tag with the canonical URL for the page, if `enable_canonical` is set to true
49
+
50
+ Web Interface
51
+ =============
52
+
53
+ Using Rails' Engines feature, Shakespeare comes with a web interface that is available to your app straight away at `http://localhost:3000/admin/pages`.
54
+
55
+ By default, this comes with no styling, but you can create a layout in `app/layouts/admin.html.erb`, or set a layout by setting `Shakespare::Settings.layout`
56
+
57
+ For example, to use your standard application layout, create a `config/initializers/shakespeare.rb` like this:
58
+
59
+ Shakespeare::Settings.layout = 'application'
60
+
61
+ You can also add before_filters to protect the controller from outsiders:
62
+
63
+ Shakespeare::Settings.before_filters << 'require_admin_user'
64
+
65
+ By default, in production, if `Shakespeare::Settings.before_filters` is empty, `/admin/pages` is protected. You can disable this protection by setting `Behavior::Settings.allow_anonymous` to true.
66
+
67
+ Running the tests
68
+ =================
69
+
70
+ You can run the tests by checking out the code into vendor/plugins of a Rails app and running:
71
+
72
+ rake
73
+
74
+ It also comes with a set of cucumber features:
75
+
76
+ cucumber
77
+
78
+ About me
79
+ ========
80
+
81
+ I'm Paul Campbell. I'm an avid Ruby on Rails web developer. Follow my ramblings at [http://www.pabcas.com](http://www.pabcas.com)
82
+
83
+ Follow me on Twitter [http://twitter.com/paulca](http://twitter.com/paulca)
84
+
85
+ Copyright (c) 2009 Paul Campbell, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,43 @@
1
+ require 'rake'
2
+ require 'spec/rake/spectask'
3
+
4
+ desc 'Default: run specs.'
5
+ task :default => :spec
6
+
7
+ desc 'Run the specs'
8
+ Spec::Rake::SpecTask.new(:spec) do |t|
9
+ t.spec_opts = ['--colour --format progress --loadby mtime --reverse']
10
+ t.spec_files = FileList['spec/**/*_spec.rb']
11
+ end
12
+
13
+ PKG_FILES = FileList[
14
+ '[a-zA-Z]*',
15
+ 'app/**/*',
16
+ 'generators/**/*',
17
+ 'config/*',
18
+ 'lib/**/*',
19
+ 'rails/**/*',
20
+ 'spec/**/*',
21
+ 'features/**/*'
22
+ ]
23
+
24
+ begin
25
+ require 'jeweler'
26
+ Jeweler::Tasks.new do |s|
27
+ s.name = "shakespeare"
28
+ s.version = "0.1.0"
29
+ s.author = "Paul Campbell"
30
+ s.email = "paul@rslw.com"
31
+ s.homepage = "http://www.github.com/paulca/shakespeare"
32
+ s.platform = Gem::Platform::RUBY
33
+ s.summary = "A Rails drop in CMS."
34
+ s.files = PKG_FILES.to_a
35
+ s.require_path = "lib"
36
+ s.has_rdoc = false
37
+ s.extra_rdoc_files = ["README.md"]
38
+ end
39
+ rescue LoadError
40
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
41
+ end
42
+
43
+ Jeweler::GemcutterTasks.new
@@ -0,0 +1,47 @@
1
+ class Admin::PagesController < ApplicationController
2
+
3
+
4
+ Shakespeare::Settings.before_filters.each do |filter|
5
+ before_filter filter
6
+ end
7
+ before_filter :protect_in_production if Shakespeare::Settings.before_filters.empty?
8
+
9
+ layout Shakespeare::Settings.layout
10
+
11
+ def index
12
+ @pages = Page.all
13
+ end
14
+
15
+ def new
16
+ @page = Page.new
17
+ end
18
+
19
+ def create
20
+ @page = Page.new(params[:page])
21
+ if @page.save
22
+ redirect_to admin_pages_path
23
+ else
24
+ render :new
25
+ end
26
+ end
27
+
28
+ def edit
29
+ @page = Page.find(params[:id])
30
+ end
31
+
32
+ def update
33
+ @page = Page.find(params[:id])
34
+ if @page.update_attributes(params[:page])
35
+ redirect_to admin_pages_path
36
+ else
37
+ render :edit
38
+ end
39
+ end
40
+
41
+ def destroy
42
+ @page = Page.find(params[:id])
43
+ @page.destroy
44
+ redirect_to admin_pages_path
45
+ end
46
+
47
+ end
@@ -0,0 +1,5 @@
1
+ class PagesController < ApplicationController
2
+ def show
3
+ @page = Page.find(params[:id])
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ class Page < ActiveRecord::Base
2
+
3
+ def robots
4
+ out = []
5
+ out << 'noindex' if noindex?
6
+ out << 'nofollow' if nofollow?
7
+ out.join(', ')
8
+ end
9
+
10
+ end
@@ -0,0 +1,38 @@
1
+ <% form_for [:admin, @page] do |f| -%>
2
+
3
+ <%= f.error_messages %>
4
+
5
+ <fieldset>
6
+ <%= f.label :url, "URL" %> <%= f.text_field :url %> <em><%= t('page.maps_to') %></em> <br />
7
+ </fieldset>
8
+
9
+ <fieldset>
10
+ <%= f.label :title, "Title" %>
11
+ <%= f.text_field :title %> <br />
12
+ <fieldset>
13
+ <legend>Robots</legend>
14
+
15
+ <%= f.check_box :noindex %>
16
+ <%= f.label :noindex, "No-Index", :class => 'inline' %>
17
+
18
+ <%= f.check_box :nofollow %>
19
+ <%= f.label :nofollow, "No-follow", :class => 'inline' %>
20
+
21
+ <%= f.check_box :enable_canonical %>
22
+ <%= f.label :enable_canonical, "Set Canonical Tag?", :class => 'inline' %>
23
+
24
+ <%= f.label :canonical, "Canonical URL" %>
25
+ <%= f.text_field :canonical %> <br />
26
+
27
+
28
+ <%= f.label :description, "Description" %> <%= f.text_area :description, :class => "small-text" %> <br />
29
+ <%= f.label :keywords, "Keywords" %> <%= f.text_field :keywords %> <br />
30
+ </fieldset>
31
+
32
+ <fieldset>
33
+ <%= f.label :content, "Content" %> <%= f.text_area :content %> <br />
34
+ </fieldset>
35
+
36
+
37
+ <%= f.submit "Save" %> or <%= link_to "Cancel", admin_pages_path %>
38
+ <% end -%>
@@ -0,0 +1,3 @@
1
+ <h2>Edit Page</h2>
2
+
3
+ <%= render 'form' %>
@@ -0,0 +1,24 @@
1
+ <h2>Pages</h2>
2
+
3
+ <ul>
4
+ <li><%= link_to "Add a New Page", new_admin_page_path %></li>
5
+ </ul>
6
+
7
+ <%- if @pages.empty? -%>
8
+ <p>No pages have been added yet.</p>
9
+ <%- else -%>
10
+ <table>
11
+ <tr>
12
+ <th>Title</th>
13
+ <th>&nbsp;</th>
14
+ </tr>
15
+
16
+ <%- @pages.each do |page| -%>
17
+ <tr>
18
+ <td><%= page.title %> (<%= link_to "Edit", edit_admin_page_path(page) %>)</td>
19
+ <td><%= link_to "Delete", admin_page_path(page), :method => :delete %></td>
20
+ </tr>
21
+ <%- end -%>
22
+
23
+ </table>
24
+ <%- end -%>
@@ -0,0 +1,3 @@
1
+ <h2>Add a New Page</h2>
2
+
3
+ <%= render 'form' %>
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <head>
3
+ <title>Admin</title>
4
+ </head>
5
+ <body>
6
+ <h1>Admin</h1>
7
+ <%= yield %>
8
+ </body>
9
+ </html>
@@ -0,0 +1,3 @@
1
+ <h2><%= @page.title %></h2>
2
+
3
+ <%= @page.content %>
@@ -0,0 +1,7 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %>
7
+ wip: --tags @wip:3 --wip features
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+
3
+ map.resources :pages
4
+
5
+ map.namespace :admin do |admin|
6
+ admin.resources :pages
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ Feature: Managing Pages
2
+ In order to update the site
3
+ As an admin
4
+ I want to add, edit and delete pages
5
+
6
+ Scenario: I'm on the admin layout
7
+ When I am on the pages admin page
8
+ Then I should see "Admin"
9
+
10
+ Scenario: New Page
11
+ Given I am on the pages admin page
12
+ When I follow "Add a New Page"
13
+ And I fill in "Title" with "Harry and the Hendersons"
14
+ And I fill in "Keywords" with "80s, movie"
15
+ And I check "No-index"
16
+ And I check "No-follow"
17
+ And I check "Set Canonical Tag?"
18
+ And I fill in "Canonical URL" with "http://hendersons.com"
19
+ And I press "Save"
20
+ Then I should see "Harry and the Hendersons"
21
+
22
+ Scenario: Edit Page
23
+ Given a page titled "Harry and the Hendersons"
24
+ And I am on the pages admin page
25
+ When I follow "Edit"
26
+ And I fill in "Title" with "Three Men and a Baby"
27
+ And I press "Save"
28
+ Then I should see "Three Men and a Baby"
29
+ And I should not see "Harry and the Hendersons"
30
+
31
+ Scenario: Delete Page
32
+ Given a page titled "The Departed"
33
+ When I am on the pages admin page
34
+ Then I should see "The Departed"
35
+
36
+ When I follow "Delete"
37
+ Then I should not see "The Departed"
38
+
@@ -0,0 +1,12 @@
1
+ Feature: Public Pages
2
+ In order to find out more information
3
+ As a user
4
+ I want to be able to see what's on a page
5
+
6
+ Scenario: A public page
7
+ Given a page titled "Mr. MacAllister's Christmas"
8
+ And page "Mr. MacAllister's Christmas" has content "I was Home Alone"
9
+
10
+ When I am on the page for "Mr. MacAllister's Christmas"
11
+
12
+ Then I should see "I was Home Alone"
@@ -0,0 +1,7 @@
1
+ Given /^a page titled "([^\"]*)"$/ do |title|
2
+ Page.make(:title => title)
3
+ end
4
+
5
+ Given /^page "([^\"]*)" has content "([^\"]*)"$/ do |title, content|
6
+ Page.find_by_title(title).update_attribute(:content, content)
7
+ end
@@ -0,0 +1,259 @@
1
+ # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
+ # It is recommended to regenerate this file in the future when you upgrade to a
3
+ # newer version of cucumber-rails. Consider adding your own code to a new file
4
+ # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
+ # files.
6
+
7
+
8
+ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
9
+
10
+ # Commonly used webrat steps
11
+ # http://github.com/brynary/webrat
12
+
13
+ Given /^(?:|I )am on (.+)$/ do |page_name|
14
+ visit path_to(page_name)
15
+ end
16
+
17
+ When /^(?:|I )go to (.+)$/ do |page_name|
18
+ visit path_to(page_name)
19
+ end
20
+
21
+ When /^(?:|I )press "([^\"]*)"$/ do |button|
22
+ click_button(button)
23
+ end
24
+
25
+ When /^(?:|I )follow "([^\"]*)"$/ do |link|
26
+ click_link(link)
27
+ end
28
+
29
+ When /^(?:|I )follow "([^\"]*)" within "([^\"]*)"$/ do |link, parent|
30
+ click_link_within(parent, link)
31
+ end
32
+
33
+ When /^(?:|I )fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
34
+ fill_in(field, :with => value)
35
+ end
36
+
37
+ When /^(?:|I )fill in "([^\"]*)" for "([^\"]*)"$/ do |value, field|
38
+ fill_in(field, :with => value)
39
+ end
40
+
41
+ # Use this to fill in an entire form with data from a table. Example:
42
+ #
43
+ # When I fill in the following:
44
+ # | Account Number | 5002 |
45
+ # | Expiry date | 2009-11-01 |
46
+ # | Note | Nice guy |
47
+ # | Wants Email? | |
48
+ #
49
+ # TODO: Add support for checkbox, select og option
50
+ # based on naming conventions.
51
+ #
52
+ When /^(?:|I )fill in the following:$/ do |fields|
53
+ fields.rows_hash.each do |name, value|
54
+ When %{I fill in "#{name}" with "#{value}"}
55
+ end
56
+ end
57
+
58
+ When /^(?:|I )select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
59
+ select(value, :from => field)
60
+ end
61
+
62
+ # Use this step in conjunction with Rail's datetime_select helper. For example:
63
+ # When I select "December 25, 2008 10:00" as the date and time
64
+ When /^(?:|I )select "([^\"]*)" as the date and time$/ do |time|
65
+ select_datetime(time)
66
+ end
67
+
68
+ # Use this step when using multiple datetime_select helpers on a page or
69
+ # you want to specify which datetime to select. Given the following view:
70
+ # <%= f.label :preferred %><br />
71
+ # <%= f.datetime_select :preferred %>
72
+ # <%= f.label :alternative %><br />
73
+ # <%= f.datetime_select :alternative %>
74
+ # The following steps would fill out the form:
75
+ # When I select "November 23, 2004 11:20" as the "Preferred" date and time
76
+ # And I select "November 25, 2004 10:30" as the "Alternative" date and time
77
+ When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
78
+ select_datetime(datetime, :from => datetime_label)
79
+ end
80
+
81
+ # Use this step in conjunction with Rail's time_select helper. For example:
82
+ # When I select "2:20PM" as the time
83
+ # Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
84
+ # will convert the 2:20PM to 14:20 and then select it.
85
+ When /^(?:|I )select "([^\"]*)" as the time$/ do |time|
86
+ select_time(time)
87
+ end
88
+
89
+ # Use this step when using multiple time_select helpers on a page or you want to
90
+ # specify the name of the time on the form. For example:
91
+ # When I select "7:30AM" as the "Gym" time
92
+ When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
93
+ select_time(time, :from => time_label)
94
+ end
95
+
96
+ # Use this step in conjunction with Rail's date_select helper. For example:
97
+ # When I select "February 20, 1981" as the date
98
+ When /^(?:|I )select "([^\"]*)" as the date$/ do |date|
99
+ select_date(date)
100
+ end
101
+
102
+ # Use this step when using multiple date_select helpers on one page or
103
+ # you want to specify the name of the date on the form. For example:
104
+ # When I select "April 26, 1982" as the "Date of Birth" date
105
+ When /^(?:|I )select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
106
+ select_date(date, :from => date_label)
107
+ end
108
+
109
+ When /^(?:|I )check "([^\"]*)"$/ do |field|
110
+ check(field)
111
+ end
112
+
113
+ When /^(?:|I )uncheck "([^\"]*)"$/ do |field|
114
+ uncheck(field)
115
+ end
116
+
117
+ When /^(?:|I )choose "([^\"]*)"$/ do |field|
118
+ choose(field)
119
+ end
120
+
121
+ # Adds support for validates_attachment_content_type. Without the mime-type getting
122
+ # passed to attach_file() you will get a "Photo file is not one of the allowed file types."
123
+ # error message
124
+ When /^(?:|I )attach the file "([^\"]*)" to "([^\"]*)"$/ do |path, field|
125
+ type = path.split(".")[1]
126
+
127
+ case type
128
+ when "jpg"
129
+ type = "image/jpg"
130
+ when "jpeg"
131
+ type = "image/jpeg"
132
+ when "png"
133
+ type = "image/png"
134
+ when "gif"
135
+ type = "image/gif"
136
+ end
137
+
138
+ attach_file(field, path, type)
139
+ end
140
+
141
+ Then /^(?:|I )should see "([^\"]*)"$/ do |text|
142
+ if defined?(Spec::Rails::Matchers)
143
+ response.should contain(text)
144
+ else
145
+ assert_contain text
146
+ end
147
+ end
148
+
149
+ Then /^(?:|I )should see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
150
+ within(selector) do |content|
151
+ if defined?(Spec::Rails::Matchers)
152
+ content.should contain(text)
153
+ else
154
+ assert content.include?(text)
155
+ end
156
+ end
157
+ end
158
+
159
+ Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
160
+ regexp = Regexp.new(regexp)
161
+ if defined?(Spec::Rails::Matchers)
162
+ response.should contain(regexp)
163
+ else
164
+ assert_contain regexp
165
+ end
166
+ end
167
+
168
+ Then /^(?:|I )should see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
169
+ within(selector) do |content|
170
+ regexp = Regexp.new(regexp)
171
+ if defined?(Spec::Rails::Matchers)
172
+ content.should contain(regexp)
173
+ else
174
+ assert content =~ regexp
175
+ end
176
+ end
177
+ end
178
+
179
+ Then /^(?:|I )should not see "([^\"]*)"$/ do |text|
180
+ if defined?(Spec::Rails::Matchers)
181
+ response.should_not contain(text)
182
+ else
183
+ assert_not_contain text
184
+ end
185
+ end
186
+
187
+ Then /^(?:|I )should not see "([^\"]*)" within "([^\"]*)"$/ do |text, selector|
188
+ within(selector) do |content|
189
+ if defined?(Spec::Rails::Matchers)
190
+ content.should_not contain(text)
191
+ else
192
+ assert !content.include?(text)
193
+ end
194
+ end
195
+ end
196
+
197
+ Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
198
+ regexp = Regexp.new(regexp)
199
+ if defined?(Spec::Rails::Matchers)
200
+ response.should_not contain(regexp)
201
+ else
202
+ assert_not_contain regexp
203
+ end
204
+ end
205
+
206
+ Then /^(?:|I )should not see \/([^\/]*)\/ within "([^\"]*)"$/ do |regexp, selector|
207
+ within(selector) do |content|
208
+ regexp = Regexp.new(regexp)
209
+ if defined?(Spec::Rails::Matchers)
210
+ content.should_not contain(regexp)
211
+ else
212
+ assert content !~ regexp
213
+ end
214
+ end
215
+ end
216
+
217
+ Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
218
+ if defined?(Spec::Rails::Matchers)
219
+ field_labeled(field).value.should =~ /#{value}/
220
+ else
221
+ assert_match(/#{value}/, field_labeled(field).value)
222
+ end
223
+ end
224
+
225
+ Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
226
+ if defined?(Spec::Rails::Matchers)
227
+ field_labeled(field).value.should_not =~ /#{value}/
228
+ else
229
+ assert_no_match(/#{value}/, field_labeled(field).value)
230
+ end
231
+ end
232
+
233
+ Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
234
+ if defined?(Spec::Rails::Matchers)
235
+ field_labeled(label).should be_checked
236
+ else
237
+ assert field_labeled(label).checked?
238
+ end
239
+ end
240
+
241
+ Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
242
+ if defined?(Spec::Rails::Matchers)
243
+ field_labeled(label).should_not be_checked
244
+ else
245
+ assert !field_labeled(label).checked?
246
+ end
247
+ end
248
+
249
+ Then /^(?:|I )should be on (.+)$/ do |page_name|
250
+ if defined?(Spec::Rails::Matchers)
251
+ URI.parse(current_url).path.should == path_to(page_name)
252
+ else
253
+ assert_equal path_to(page_name), URI.parse(current_url).path
254
+ end
255
+ end
256
+
257
+ Then /^show me the page$/ do
258
+ save_and_open_page
259
+ end