jabe 0.5.9 → 0.6.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.
- data/{LICENSE.txt → MIT-LICENSE} +1 -1
- data/README.textile +46 -31
- data/Rakefile +30 -47
- data/app/assets/images/jabe/delete.png +0 -0
- data/{public/images → app/assets/images/jabe}/delete_page.png +0 -0
- data/{public/images → app/assets/images/jabe}/full_page.png +0 -0
- data/{public/images → app/assets/images/jabe}/gravatar.gif +0 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/application.js +15 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/libs/dd_belatedpng.js +0 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/libs/modernizr-1.6.min.js +0 -0
- data/{public/javascripts → app/assets/javascripts/jabe}/plugins.js +0 -0
- data/app/assets/stylesheets/jabe/application.css +3 -0
- data/app/{stylesheets → assets/stylesheets/jabe}/boilerplate.scss +0 -0
- data/app/{stylesheets → assets/stylesheets/jabe}/jabe.scss +47 -8
- data/app/controllers/jabe/admin/base_controller.rb +7 -0
- data/app/controllers/jabe/admin/entries_controller.rb +49 -0
- data/app/controllers/jabe/admin/settings_controller.rb +13 -0
- data/app/controllers/jabe/application_controller.rb +5 -0
- data/app/controllers/jabe/comments_controller.rb +34 -0
- data/app/controllers/jabe/entries_controller.rb +30 -0
- data/app/controllers/jabe/feed_controller.rb +8 -0
- data/app/controllers/jabe/sessions_controller.rb +4 -0
- data/app/helpers/jabe/application_helper.rb +25 -0
- data/app/mailers/jabe/comment_mailer.rb +12 -0
- data/app/models/jabe/admin.rb +11 -0
- data/app/models/jabe/comment.rb +35 -0
- data/app/models/jabe/entry.rb +22 -0
- data/app/models/jabe/settings.rb +14 -0
- data/app/views/{admin → jabe/admin}/entries/_form.html.haml +1 -1
- data/app/views/{admin → jabe/admin}/entries/edit.html.haml +0 -0
- data/app/views/{admin → jabe/admin}/entries/index.html.haml +9 -7
- data/app/views/{admin → jabe/admin}/entries/new.html.haml +0 -0
- data/app/views/{admin → jabe/admin}/settings/edit.html.haml +2 -1
- data/app/views/jabe/comment_mailer/notification.html.erb +19 -0
- data/app/views/jabe/confirmations/new.html.erb +15 -0
- data/app/views/{entries → jabe/entries}/index.html.haml +4 -3
- data/app/views/jabe/entries/show.html.haml +49 -0
- data/app/views/{feed → jabe/feed}/index.xml.builder +3 -3
- data/app/views/jabe/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/jabe/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/jabe/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/jabe/passwords/edit.html.erb +19 -0
- data/app/views/jabe/passwords/new.html.erb +15 -0
- data/app/views/jabe/registrations/edit.html.erb +22 -0
- data/app/views/jabe/registrations/new.html.erb +17 -0
- data/app/views/jabe/sessions/new.html.erb +15 -0
- data/app/views/jabe/shared/_links.erb +25 -0
- data/app/views/jabe/unlocks/new.html.erb +15 -0
- data/app/views/layouts/jabe/_flashes.html.haml +3 -0
- data/app/views/layouts/{_footer.html.haml → jabe/_footer.html.haml} +0 -0
- data/app/views/layouts/jabe/_header.html.haml +4 -0
- data/app/views/layouts/jabe/_sidebar.html.haml +21 -0
- data/app/views/layouts/jabe/application.html.haml +63 -0
- data/{test/dummy/vendor/plugins/acts_as_textiled/init.rb → config/initializers/acts_as_textiled.rb} +2 -1
- data/config/initializers/devise.rb +3 -0
- data/config/initializers/settings.rb +5 -5
- data/config/initializers/simple_form.rb +93 -0
- data/config/initializers/time_formats.rb +1 -2
- data/config/locales/simple_form.en.yml +24 -0
- data/config/routes.rb +10 -5
- data/{test/dummy/db/migrate/20101229224027_create_settings.rb → db/migrate/20101230010434_create_settings.rb} +7 -2
- data/{lib/generators/jabe/templates/migrations/devise_create_admins.rb → db/migrate/20101230010436_devise_create_admins.rb} +6 -6
- data/{test/dummy/db/migrate/20101229224030_create_entries.rb → db/migrate/20101230010437_create_entries.rb} +2 -2
- data/{test/dummy/db/migrate/20101229224031_create_comments.rb → db/migrate/20101230010438_create_comments.rb} +3 -4
- data/{test/dummy/vendor/plugins/acts_as_textiled/lib/acts_as_textiled.rb → lib/acts_as_textiled/base.rb} +0 -0
- data/lib/jabe.rb +7 -15
- data/lib/jabe/engine.rb +5 -0
- data/lib/jabe/version.rb +3 -0
- data/lib/tasks/jabe_tasks.rake +4 -0
- metadata +187 -601
- data/Gemfile +0 -35
- data/Gemfile.lock +0 -214
- data/VERSION +0 -1
- data/app/controllers/admin/base_controller.rb +0 -3
- data/app/controllers/admin/entries_controller.rb +0 -42
- data/app/controllers/admin/settings_controller.rb +0 -11
- data/app/controllers/comments_controller.rb +0 -25
- data/app/controllers/entries_controller.rb +0 -26
- data/app/controllers/feed_controller.rb +0 -8
- data/app/helpers/jabe_helper.rb +0 -13
- data/app/models/admin.rb +0 -9
- data/app/models/comment.rb +0 -22
- data/app/models/entry.rb +0 -17
- data/app/models/settings.rb +0 -7
- data/app/stylesheets/_will_paginate.scss +0 -102
- data/app/stylesheets/handheld.scss +0 -7
- data/app/views/entries/_comment_form.html.haml +0 -3
- data/app/views/entries/show.html.haml +0 -38
- data/app/views/layouts/_header.html.haml +0 -4
- data/app/views/layouts/_sidebar.html.haml +0 -21
- data/app/views/layouts/application.html.haml +0 -59
- data/config/initializers/sass.rb +0 -5
- data/lib/generators/jabe/migrations/migrations_generator.rb +0 -38
- data/lib/generators/jabe/stylesheets/stylesheets_generator.rb +0 -9
- data/lib/generators/jabe/templates/migrations/add_new_settings.rb +0 -17
- data/lib/generators/jabe/templates/migrations/create_comments.rb +0 -20
- data/lib/generators/jabe/templates/migrations/create_entries.rb +0 -16
- data/lib/generators/jabe/templates/migrations/create_settings.rb +0 -21
- data/lib/generators/jabe/templates/migrations/create_slugs.rb +0 -18
- data/public/.htaccess +0 -220
- data/public/apple-touch-icon.png +0 -0
- data/public/blackbird/blackbird.css +0 -80
- data/public/blackbird/blackbird.js +0 -365
- data/public/blackbird/blackbird.png +0 -0
- data/public/crossdomain.xml +0 -25
- data/public/javascripts/jquery-ui.js +0 -11511
- data/public/javascripts/jquery-ui.min.js +0 -404
- data/public/javascripts/jquery.js +0 -7179
- data/public/javascripts/jquery.min.js +0 -167
- data/public/javascripts/libs/profiling/charts.swf +0 -0
- data/public/javascripts/libs/profiling/config.js +0 -59
- data/public/javascripts/libs/profiling/yahoo-profiling.css +0 -7
- data/public/javascripts/libs/profiling/yahoo-profiling.min.js +0 -39
- data/public/javascripts/rails.js +0 -154
- data/public/nginx.conf +0 -108
- data/public/robots.txt +0 -5
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/config/application.rb +0 -52
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -26
- data/test/dummy/config/environments/production.rb +0 -49
- data/test/dummy/config/environments/test.rb +0 -35
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/devise.rb +0 -142
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/migrate/20101229224028_create_slugs.rb +0 -18
- data/test/dummy/db/migrate/20101229224029_devise_create_admins.rb +0 -26
- data/test/dummy/db/migrate/20110104004400_add_new_settings.rb +0 -17
- data/test/dummy/db/schema.rb +0 -110
- data/test/dummy/features/step_definitions/admin_steps.rb +0 -14
- data/test/dummy/features/step_definitions/email_steps.rb +0 -194
- data/test/dummy/features/step_definitions/entry_steps.rb +0 -54
- data/test/dummy/features/step_definitions/support_steps.rb +0 -3
- data/test/dummy/features/step_definitions/web_steps.rb +0 -219
- data/test/dummy/features/support/blueprints.rb +0 -37
- data/test/dummy/features/support/env.rb +0 -59
- data/test/dummy/features/support/paths.rb +0 -39
- data/test/dummy/spec/spec_helper.rb +0 -0
- data/test/dummy/spec/support/blueprints.rb +0 -9
- data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/author.rb +0 -4
- data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/story.rb +0 -4
- data/test/dummy/vendor/plugins/acts_as_textiled/test/helper.rb +0 -87
- data/test/dummy/vendor/plugins/acts_as_textiled/test/textiled_test.rb +0 -145
|
@@ -1,219 +0,0 @@
|
|
|
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 'uri'
|
|
9
|
-
require 'cgi'
|
|
10
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
|
11
|
-
|
|
12
|
-
module WithinHelpers
|
|
13
|
-
def with_scope(locator)
|
|
14
|
-
locator ? within(locator) { yield } : yield
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
World(WithinHelpers)
|
|
18
|
-
|
|
19
|
-
Given /^(?:|I )am on (.+)$/ do |page_name|
|
|
20
|
-
visit path_to(page_name)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
When /^(?:|I )go to (.+)$/ do |page_name|
|
|
24
|
-
visit path_to(page_name)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
|
|
28
|
-
with_scope(selector) do
|
|
29
|
-
click_button(button)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
|
|
34
|
-
with_scope(selector) do
|
|
35
|
-
click_link(link)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
|
|
40
|
-
with_scope(selector) do
|
|
41
|
-
fill_in(field, :with => value)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
|
46
|
-
with_scope(selector) do
|
|
47
|
-
fill_in(field, :with => value)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# Use this to fill in an entire form with data from a table. Example:
|
|
52
|
-
#
|
|
53
|
-
# When I fill in the following:
|
|
54
|
-
# | Account Number | 5002 |
|
|
55
|
-
# | Expiry date | 2009-11-01 |
|
|
56
|
-
# | Note | Nice guy |
|
|
57
|
-
# | Wants Email? | |
|
|
58
|
-
#
|
|
59
|
-
# TODO: Add support for checkbox, select og option
|
|
60
|
-
# based on naming conventions.
|
|
61
|
-
#
|
|
62
|
-
When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
|
|
63
|
-
with_scope(selector) do
|
|
64
|
-
fields.rows_hash.each do |name, value|
|
|
65
|
-
When %{I fill in "#{name}" with "#{value}"}
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
|
71
|
-
with_scope(selector) do
|
|
72
|
-
select(value, :from => field)
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
|
77
|
-
with_scope(selector) do
|
|
78
|
-
check(field)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
|
83
|
-
with_scope(selector) do
|
|
84
|
-
uncheck(field)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
|
89
|
-
with_scope(selector) do
|
|
90
|
-
choose(field)
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
|
|
95
|
-
with_scope(selector) do
|
|
96
|
-
attach_file(field, path)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
Then /^(?:|I )should see JSON:$/ do |expected_json|
|
|
101
|
-
require 'json'
|
|
102
|
-
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
|
103
|
-
actual = JSON.pretty_generate(JSON.parse(response.body))
|
|
104
|
-
expected.should == actual
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
|
108
|
-
with_scope(selector) do
|
|
109
|
-
if page.respond_to? :should
|
|
110
|
-
page.should have_content(text)
|
|
111
|
-
else
|
|
112
|
-
assert page.has_content?(text)
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
|
118
|
-
regexp = Regexp.new(regexp)
|
|
119
|
-
with_scope(selector) do
|
|
120
|
-
if page.respond_to? :should
|
|
121
|
-
page.should have_xpath('//*', :text => regexp)
|
|
122
|
-
else
|
|
123
|
-
assert page.has_xpath?('//*', :text => regexp)
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
|
129
|
-
with_scope(selector) do
|
|
130
|
-
if page.respond_to? :should
|
|
131
|
-
page.should have_no_content(text)
|
|
132
|
-
else
|
|
133
|
-
assert page.has_no_content?(text)
|
|
134
|
-
end
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
|
139
|
-
regexp = Regexp.new(regexp)
|
|
140
|
-
with_scope(selector) do
|
|
141
|
-
if page.respond_to? :should
|
|
142
|
-
page.should have_no_xpath('//*', :text => regexp)
|
|
143
|
-
else
|
|
144
|
-
assert page.has_no_xpath?('//*', :text => regexp)
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
|
|
150
|
-
with_scope(selector) do
|
|
151
|
-
field = find_field(field)
|
|
152
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
|
153
|
-
if field_value.respond_to? :should
|
|
154
|
-
field_value.should =~ /#{value}/
|
|
155
|
-
else
|
|
156
|
-
assert_match(/#{value}/, field_value)
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
|
|
162
|
-
with_scope(selector) do
|
|
163
|
-
field = find_field(field)
|
|
164
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
|
165
|
-
if field_value.respond_to? :should_not
|
|
166
|
-
field_value.should_not =~ /#{value}/
|
|
167
|
-
else
|
|
168
|
-
assert_no_match(/#{value}/, field_value)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
|
|
174
|
-
with_scope(selector) do
|
|
175
|
-
field_checked = find_field(label)['checked']
|
|
176
|
-
if field_checked.respond_to? :should
|
|
177
|
-
field_checked.should be_true
|
|
178
|
-
else
|
|
179
|
-
assert field_checked
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
|
|
185
|
-
with_scope(selector) do
|
|
186
|
-
field_checked = find_field(label)['checked']
|
|
187
|
-
if field_checked.respond_to? :should
|
|
188
|
-
field_checked.should be_false
|
|
189
|
-
else
|
|
190
|
-
assert !field_checked
|
|
191
|
-
end
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
|
196
|
-
current_path = URI.parse(current_url).path
|
|
197
|
-
if current_path.respond_to? :should
|
|
198
|
-
current_path.should == path_to(page_name)
|
|
199
|
-
else
|
|
200
|
-
assert_equal path_to(page_name), current_path
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
|
|
204
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
205
|
-
query = URI.parse(current_url).query
|
|
206
|
-
actual_params = query ? CGI.parse(query) : {}
|
|
207
|
-
expected_params = {}
|
|
208
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
|
209
|
-
|
|
210
|
-
if actual_params.respond_to? :should
|
|
211
|
-
actual_params.should == expected_params
|
|
212
|
-
else
|
|
213
|
-
assert_equal expected_params, actual_params
|
|
214
|
-
end
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
Then /^show me the page$/ do
|
|
218
|
-
save_and_open_page
|
|
219
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require 'email_spec'
|
|
2
|
-
require 'email_spec/cucumber'
|
|
3
|
-
require 'machinist/active_record'
|
|
4
|
-
|
|
5
|
-
# takes care of
|
|
6
|
-
# Validation failed: Email has already been taken (ActiveRecord::RecordInvalid)
|
|
7
|
-
Machinist.configure do |config|
|
|
8
|
-
config.cache_objects = false
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
Admin.blueprint do
|
|
12
|
-
email { 'admin@example.com' }
|
|
13
|
-
password { 'password' }
|
|
14
|
-
password_confirmation { 'password' }
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
Settings.blueprint do
|
|
18
|
-
site_name { 'JABE' }
|
|
19
|
-
site_url { 'http://example.com' }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
Entry.blueprint do
|
|
23
|
-
title { 'My awesome blog entry' }
|
|
24
|
-
body { 'This is the body of my awesome blog entry' }
|
|
25
|
-
published_at { Time.now }
|
|
26
|
-
draft { false }
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
Entry.blueprint(:published) do
|
|
30
|
-
draft { false }
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
Comment.blueprint do
|
|
34
|
-
# Attributes here
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
Settings.make!
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
ENV["RAILS_ENV"] ||= "test"
|
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
|
9
|
-
|
|
10
|
-
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
|
11
|
-
require 'cucumber/rails/rspec'
|
|
12
|
-
require 'cucumber/rails/world'
|
|
13
|
-
require 'cucumber/rails/active_record'
|
|
14
|
-
require 'cucumber/web/tableish'
|
|
15
|
-
|
|
16
|
-
require 'capybara/rails'
|
|
17
|
-
require 'capybara/cucumber'
|
|
18
|
-
require 'capybara/session'
|
|
19
|
-
#require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
|
|
20
|
-
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
|
21
|
-
# order to ease the transition to Capybara we set the default here. If you'd
|
|
22
|
-
# prefer to use XPath just remove this line and adjust any selectors in your
|
|
23
|
-
# steps to use the XPath syntax.
|
|
24
|
-
Capybara.default_selector = :css
|
|
25
|
-
|
|
26
|
-
# If you set this to false, any error raised from within your app will bubble
|
|
27
|
-
# up to your step definition and out to cucumber unless you catch it somewhere
|
|
28
|
-
# on the way. You can make Rails rescue errors and render error pages on a
|
|
29
|
-
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
|
30
|
-
#
|
|
31
|
-
# If you set this to true, Rails will rescue all errors and render error
|
|
32
|
-
# pages, more or less in the same way your application would behave in the
|
|
33
|
-
# default production environment. It's not recommended to do this for all
|
|
34
|
-
# of your scenarios, as this makes it hard to discover errors in your application.
|
|
35
|
-
ActionController::Base.allow_rescue = false
|
|
36
|
-
|
|
37
|
-
# If you set this to true, each scenario will run in a database transaction.
|
|
38
|
-
# You can still turn off transactions on a per-scenario basis, simply tagging
|
|
39
|
-
# a feature or scenario with the @no-txn tag. If you are using Capybara,
|
|
40
|
-
# tagging with @culerity or @javascript will also turn transactions off.
|
|
41
|
-
#
|
|
42
|
-
# If you set this to false, transactions will be off for all scenarios,
|
|
43
|
-
# regardless of whether you use @no-txn or not.
|
|
44
|
-
#
|
|
45
|
-
# Beware that turning transactions off will leave data in your database
|
|
46
|
-
# after each scenario, which can lead to hard-to-debug failures in
|
|
47
|
-
# subsequent scenarios. If you do this, we recommend you create a Before
|
|
48
|
-
# block that will explicitly put your database in a known state.
|
|
49
|
-
Cucumber::Rails::World.use_transactional_fixtures = true
|
|
50
|
-
# How to clean your database when transactions are turned off. See
|
|
51
|
-
# http://github.com/bmabey/database_cleaner for more info.
|
|
52
|
-
if defined?(ActiveRecord::Base)
|
|
53
|
-
begin
|
|
54
|
-
require 'database_cleaner'
|
|
55
|
-
DatabaseCleaner.strategy = :truncation
|
|
56
|
-
DatabaseCleaner.clean
|
|
57
|
-
rescue LoadError => ignore_if_database_cleaner_not_present
|
|
58
|
-
end
|
|
59
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
module NavigationHelpers
|
|
2
|
-
# Maps a name to a path. Used by the
|
|
3
|
-
#
|
|
4
|
-
# When /^I go to (.+)$/ do |page_name|
|
|
5
|
-
#
|
|
6
|
-
# step definition in web_steps.rb
|
|
7
|
-
#
|
|
8
|
-
def path_to(page_name)
|
|
9
|
-
case page_name
|
|
10
|
-
|
|
11
|
-
when /the home\s?page/
|
|
12
|
-
'/'
|
|
13
|
-
when 'the admin home page'
|
|
14
|
-
admin_root_path
|
|
15
|
-
when 'the entry page'
|
|
16
|
-
entry_path(Entry.last)
|
|
17
|
-
when 'the feed url'
|
|
18
|
-
feed_path
|
|
19
|
-
|
|
20
|
-
# Add more mappings here.
|
|
21
|
-
# Here is an example that pulls values out of the Regexp:
|
|
22
|
-
#
|
|
23
|
-
# when /^(.*)'s profile page$/i
|
|
24
|
-
# user_profile_path(User.find_by_login($1))
|
|
25
|
-
|
|
26
|
-
else
|
|
27
|
-
begin
|
|
28
|
-
page_name =~ /the (.*) page/
|
|
29
|
-
path_components = $1.split(/\s+/)
|
|
30
|
-
self.send(path_components.push('path').join('_').to_sym)
|
|
31
|
-
rescue Object => e
|
|
32
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
|
33
|
-
"Now, go and add a mapping in #{__FILE__}"
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
World(NavigationHelpers)
|
|
File without changes
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
$:.unshift File.dirname(__FILE__) + '/../lib'
|
|
2
|
-
|
|
3
|
-
begin
|
|
4
|
-
require 'rubygems'
|
|
5
|
-
require 'yaml'
|
|
6
|
-
require 'mocha'
|
|
7
|
-
require 'active_support'
|
|
8
|
-
require 'test/spec'
|
|
9
|
-
require 'RedCloth'
|
|
10
|
-
rescue LoadError
|
|
11
|
-
puts "acts_as_textiled requires the mocha and test-spec gems to run its tests"
|
|
12
|
-
exit
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
class ActiveRecord
|
|
16
|
-
class Base
|
|
17
|
-
attr_reader :attributes
|
|
18
|
-
|
|
19
|
-
def initialize(attributes = {})
|
|
20
|
-
@attributes = attributes.dup
|
|
21
|
-
after_find if respond_to?(:after_find)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def method_missing(name, *args)
|
|
25
|
-
if name.to_s[/=/]
|
|
26
|
-
@attributes[key = name.to_s.sub('=','')] = value = args.first
|
|
27
|
-
write_attribute key, value
|
|
28
|
-
else
|
|
29
|
-
self[name.to_s]
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def save
|
|
34
|
-
true
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def reload
|
|
38
|
-
self
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def [](value)
|
|
42
|
-
@attributes[value.to_s.sub('_before_type_cast', '')]
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def self.global
|
|
46
|
-
eval("$#{name.downcase}")
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def self.find(id)
|
|
50
|
-
item = global.detect { |key, hash| hash['id'] == id }.last
|
|
51
|
-
new(item)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end unless defined? ActiveRecord
|
|
55
|
-
|
|
56
|
-
require File.dirname(__FILE__) + '/../init'
|
|
57
|
-
|
|
58
|
-
class Author < ActiveRecord::Base
|
|
59
|
-
acts_as_textiled :blog => :lite_mode
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
class Story < ActiveRecord::Base
|
|
63
|
-
acts_as_textiled :body, :description => :lite_mode
|
|
64
|
-
|
|
65
|
-
def author
|
|
66
|
-
@author ||= Author.find(author_id)
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
class StoryWithAfterFind < Story
|
|
71
|
-
acts_as_textiled :body, :description => :lite_mode
|
|
72
|
-
|
|
73
|
-
def after_find
|
|
74
|
-
textilize
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
def self.name
|
|
78
|
-
Story.name
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def author
|
|
82
|
-
@author ||= Author.find(author_id)
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
$author = YAML.load_file(File.dirname(__FILE__) + '/fixtures/authors.yml')
|
|
87
|
-
$story = YAML.load_file(File.dirname(__FILE__) + '/fixtures/stories.yml')
|