jabe 0.5.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/Gemfile +35 -0
- data/Gemfile.lock +217 -0
- data/LICENSE.txt +20 -0
- data/README.textile +12 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/app/controllers/admin/base_controller.rb +3 -0
- data/app/controllers/admin/entries_controller.rb +42 -0
- data/app/controllers/admin/settings_controller.rb +11 -0
- data/app/controllers/comments_controller.rb +25 -0
- data/app/controllers/entries_controller.rb +26 -0
- data/app/helpers/application_helper.rb +9 -0
- data/app/models/admin.rb +9 -0
- data/app/models/comment.rb +17 -0
- data/app/models/entry.rb +17 -0
- data/app/models/settings.rb +2 -0
- data/app/stylesheets/_will_paginate.scss +102 -0
- data/app/stylesheets/application.scss +247 -0
- data/app/stylesheets/grid.scss +336 -0
- data/app/stylesheets/handheld.scss +7 -0
- data/app/stylesheets/style.scss +273 -0
- data/app/views/admin/entries/_form.html.haml +6 -0
- data/app/views/admin/entries/edit.html.haml +1 -0
- data/app/views/admin/entries/index.html.haml +43 -0
- data/app/views/admin/entries/new.html.haml +1 -0
- data/app/views/admin/settings/edit.html.haml +9 -0
- data/app/views/entries/_comment.html.haml +0 -0
- data/app/views/entries/_comment_form.html.haml +3 -0
- data/app/views/entries/index.html.haml +13 -0
- data/app/views/entries/show.html.haml +36 -0
- data/app/views/layouts/_footer.html.haml +2 -0
- data/app/views/layouts/_header.html.haml +4 -0
- data/app/views/layouts/_sidebar.html.haml +0 -0
- data/app/views/layouts/application.html.haml +59 -0
- data/config/initializers/sass.rb +5 -0
- data/config/initializers/settings.rb +5 -0
- data/config/initializers/time_formats.rb +4 -0
- data/config/routes.rb +26 -0
- data/features/admin.feature +30 -0
- data/features/entries.feature +24 -0
- data/features/step_definitions/admin_steps.rb +14 -0
- data/features/step_definitions/entry_steps.rb +35 -0
- data/features/step_definitions/support_steps.rb +3 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/blueprints.rb +31 -0
- data/features/support/env.rb +59 -0
- data/features/support/paths.rb +37 -0
- data/lib/generators/jabe/migrations/migrations_generator.rb +42 -0
- data/lib/generators/jabe/templates/migrations/create_comments.rb +20 -0
- data/lib/generators/jabe/templates/migrations/create_entries.rb +16 -0
- data/lib/generators/jabe/templates/migrations/create_settings.rb +21 -0
- data/lib/generators/jabe/templates/migrations/create_slugs.rb +18 -0
- data/lib/generators/jabe/templates/migrations/devise_create_admins.rb +26 -0
- data/lib/jabe.rb +9 -0
- data/public/.htaccess +220 -0
- data/public/apple-touch-icon.png +0 -0
- data/public/blackbird/blackbird.css +80 -0
- data/public/blackbird/blackbird.js +365 -0
- data/public/blackbird/blackbird.png +0 -0
- data/public/crossdomain.xml +25 -0
- data/public/images/delete_page.png +0 -0
- data/public/images/full_page.png +0 -0
- data/public/javascripts/application.js +34 -0
- data/public/javascripts/jquery-ui.js +11511 -0
- data/public/javascripts/jquery-ui.min.js +404 -0
- data/public/javascripts/jquery.js +7179 -0
- data/public/javascripts/jquery.min.js +167 -0
- data/public/javascripts/libs/dd_belatedpng.js +13 -0
- data/public/javascripts/libs/modernizr-1.6.min.js +30 -0
- data/public/javascripts/libs/profiling/charts.swf +0 -0
- data/public/javascripts/libs/profiling/config.js +59 -0
- data/public/javascripts/libs/profiling/yahoo-profiling.css +7 -0
- data/public/javascripts/libs/profiling/yahoo-profiling.min.js +39 -0
- data/public/javascripts/plugins.js +40 -0
- data/public/javascripts/rails.js +154 -0
- data/public/nginx.conf +108 -0
- data/public/robots.txt +5 -0
- data/spec/support/blueprints.rb +31 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/config/application.rb +45 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +26 -0
- data/test/dummy/config/environments/production.rb +49 -0
- data/test/dummy/config/environments/test.rb +35 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/devise.rb +142 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/migrate/20101229224027_create_settings.rb +21 -0
- data/test/dummy/db/migrate/20101229224028_create_slugs.rb +18 -0
- data/test/dummy/db/migrate/20101229224029_devise_create_admins.rb +26 -0
- data/test/dummy/db/migrate/20101229224030_create_entries.rb +16 -0
- data/test/dummy/db/migrate/20101229224031_create_comments.rb +20 -0
- data/test/dummy/db/schema.rb +82 -0
- data/test/dummy/vendor/plugins/acts_as_textiled/init.rb +8 -0
- data/test/dummy/vendor/plugins/acts_as_textiled/lib/acts_as_textiled.rb +108 -0
- data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/author.rb +4 -0
- data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/story.rb +4 -0
- data/test/dummy/vendor/plugins/acts_as_textiled/test/helper.rb +87 -0
- data/test/dummy/vendor/plugins/acts_as_textiled/test/textiled_test.rb +145 -0
- metadata +641 -0
data/config/routes.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Rails::Application.routes.draw do
|
|
2
|
+
|
|
3
|
+
root :to => "entries#index"
|
|
4
|
+
|
|
5
|
+
resources :entries do
|
|
6
|
+
resources :comments
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
namespace :admin do
|
|
10
|
+
root :to => 'entries#index'
|
|
11
|
+
resource :settings
|
|
12
|
+
resources :entries
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
devise_for :admin, :path_names => {
|
|
16
|
+
:sign_in => 'login',
|
|
17
|
+
:sign_out => 'logout'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
match "/:year/:month/:day/:id" => 'entries#show',
|
|
21
|
+
:constraints => {
|
|
22
|
+
:year => /\d{4}/,
|
|
23
|
+
:month => /\d{1,2}/,
|
|
24
|
+
:day => /\d{1,2}/
|
|
25
|
+
}
|
|
26
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Feature: Site management
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given a logged in admin
|
|
5
|
+
|
|
6
|
+
Scenario: An admin edits the site settings
|
|
7
|
+
When I follow "Settings"
|
|
8
|
+
And I fill in "settings_site_name" with "Pixels and Bits"
|
|
9
|
+
And I press "Save"
|
|
10
|
+
Then I should see "Pixels and Bits"
|
|
11
|
+
|
|
12
|
+
Scenario: An admin wants to add a new entry as a draft, then publish
|
|
13
|
+
When I follow "Entries"
|
|
14
|
+
And I follow "Start a new entry"
|
|
15
|
+
And I fill in "entry_title" with "Is this thing on"
|
|
16
|
+
And I fill in "entry_body" with "Hrm, Who knows"
|
|
17
|
+
And I press "Save as draft"
|
|
18
|
+
Then the entry should be a draft
|
|
19
|
+
When I go to the home page
|
|
20
|
+
Then I should not see the entry
|
|
21
|
+
When I follow "Logout"
|
|
22
|
+
And I go to the entry page
|
|
23
|
+
Then the response should be a 404
|
|
24
|
+
Given a logged in admin
|
|
25
|
+
And I go to the admin home page
|
|
26
|
+
And I follow "Entries"
|
|
27
|
+
And I follow the title of the entry
|
|
28
|
+
And I press "Publish"
|
|
29
|
+
And I go to the home page
|
|
30
|
+
Then I should see the entry
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Feature: Interacting with entries
|
|
2
|
+
|
|
3
|
+
Background:
|
|
4
|
+
Given a published entry
|
|
5
|
+
When I am on the home page
|
|
6
|
+
And I follow the title of the entry
|
|
7
|
+
Then I should see the entry
|
|
8
|
+
|
|
9
|
+
Scenario: A human submits a comment
|
|
10
|
+
When I fill in "comment_name" with "Michael"
|
|
11
|
+
And I fill in "comment_email" with "michael@example.com"
|
|
12
|
+
And I fill in "comment_body" with "Cool post"
|
|
13
|
+
And I press "Add comment"
|
|
14
|
+
Then I should see "Michael"
|
|
15
|
+
And I should see "Cool post"
|
|
16
|
+
And the entry should have 1 comment
|
|
17
|
+
|
|
18
|
+
Scenario: A bot submits a comment
|
|
19
|
+
When I fill in "comment_name" with "v1@gr@"
|
|
20
|
+
And I fill in "comment_nickname" with "blue pill"
|
|
21
|
+
And I fill in "comment_email" with "spambot@example.com"
|
|
22
|
+
And I fill in "comment_body" with "take the blue pill"
|
|
23
|
+
And I press "Add comment"
|
|
24
|
+
Then the entry should have 0 comments
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Given /^a logged in admin$/ do
|
|
2
|
+
@admin ||= Admin.make!
|
|
3
|
+
steps %Q{
|
|
4
|
+
When I go to the admin home page
|
|
5
|
+
And I fill in "admin_email" with "admin@example.com"
|
|
6
|
+
And I fill in "admin_password" with "password"
|
|
7
|
+
And I press "Sign in"
|
|
8
|
+
Then I should be on the admin home page
|
|
9
|
+
}
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Then /^I should see the settings options$/ do
|
|
13
|
+
pending # express the regexp above with the code you wish you had
|
|
14
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Given /^a published entry$/ do
|
|
2
|
+
Entry.make!(:published)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then /^the entry should be a draft$/ do
|
|
6
|
+
entry = @entry || Entry.last
|
|
7
|
+
entry.draft.should be_true
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Then /^I should not see the entry$/ do
|
|
11
|
+
entry = @entry || Entry.last
|
|
12
|
+
steps %Q{
|
|
13
|
+
And I should not see "#{entry.title}"
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When /^I follow the title of the entry$/ do
|
|
18
|
+
entry = @entry || Entry.last
|
|
19
|
+
steps %Q{
|
|
20
|
+
And I follow "#{entry.title}"
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Then /^I should see the entry$/ do
|
|
25
|
+
entry = @entry || Entry.last
|
|
26
|
+
steps %Q{
|
|
27
|
+
And I should see "#{entry.title}"
|
|
28
|
+
And I should see "#{entry.body(:source)}"
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
Then /^the entry should have (\d+) comments?$/ do |count|
|
|
33
|
+
entry = @entry || Entry.last
|
|
34
|
+
entry.comments.count.should eql(count.to_i)
|
|
35
|
+
end
|
|
@@ -0,0 +1,219 @@
|
|
|
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
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'machinist/active_record'
|
|
2
|
+
|
|
3
|
+
# takes care of
|
|
4
|
+
# Validation failed: Email has already been taken (ActiveRecord::RecordInvalid)
|
|
5
|
+
Machinist.configure do |config|
|
|
6
|
+
config.cache_objects = false
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Admin.blueprint do
|
|
10
|
+
email { 'admin@example.com' }
|
|
11
|
+
password { 'password' }
|
|
12
|
+
password_confirmation { 'password' }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Settings.blueprint do
|
|
16
|
+
# Attributes here
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Entry.blueprint do
|
|
20
|
+
title { Faker::Lorem.words.to_s }
|
|
21
|
+
body { Faker::Lorem.paragraph }
|
|
22
|
+
published_at { Time.now }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Entry.blueprint(:published) do
|
|
26
|
+
draft { false }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Comment.blueprint do
|
|
30
|
+
# Attributes here
|
|
31
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|