noodall-devise 0.0.1
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/.gitignore +8 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +217 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +38 -0
- data/app/controllers/admin/users_controller.rb +85 -0
- data/app/helpers/admin/users_helper.rb +3 -0
- data/app/models/user.rb +21 -0
- data/app/views/admin/users/index.html.erb +39 -0
- data/app/views/admin/users/show.html.erb +37 -0
- data/config/locales/devise.en.yml +39 -0
- data/config/locales/en.yml +5 -0
- data/cucumber.yml +8 -0
- data/features/manage_users.feature +44 -0
- data/features/step_definitions/user_steps.rb +47 -0
- data/features/step_definitions/web_steps.rb +219 -0
- data/features/support/env.rb +49 -0
- data/features/support/paths.rb +19 -0
- data/lib/noodall-devise.rb +2 -0
- data/lib/noodall/devise/engine.rb +9 -0
- data/lib/noodall/devise/version.rb +5 -0
- data/noodall-devise.gemspec +24 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/home_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +3 -0
- data/spec/dummy/app/views/home/index.html.erb +1 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +44 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +15 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/devise.rb +142 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/mongo_mapper.rb +13 -0
- data/spec/dummy/config/initializers/noodall.rb +2 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/user.rb +14 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/noodall_devise_spec.rb +7 -0
- data/spec/spec_helper.rb +30 -0
- metadata +173 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
<h1><%= @user.new_record? ? 'New' : 'Editing' %> User</h1>
|
2
|
+
|
3
|
+
<%= form_for([:admin, @user]) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :name %><br/>
|
8
|
+
<%= f.text_field :name %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= f.label :email %><br/>
|
13
|
+
<%= f.text_field :email %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<p>
|
17
|
+
<%= f.label :password %><br/>
|
18
|
+
<%= f.password_field :password, :onKeyUp => "updateStrength(this.value)" %>
|
19
|
+
<div id="password-meter"><strong>Strength</strong><div id = "psContainer"><div id = "psStrength"></div></div></div>
|
20
|
+
</p>
|
21
|
+
|
22
|
+
<p>
|
23
|
+
<%= f.label :password_confirmation %><br/>
|
24
|
+
<%= f.password_field :password_confirmation %>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
<p>
|
28
|
+
<%= f.label :groups %><br/>
|
29
|
+
<%= f.text_field :groups %>
|
30
|
+
</p>
|
31
|
+
|
32
|
+
<p>
|
33
|
+
<%= f.submit @user.new_record? ? 'Create' : 'Update', :disable_with => 'Submitting...' %> or <%= link_to 'Cancel', admin_users_path %>
|
34
|
+
</p>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
messages:
|
4
|
+
not_found: "not found"
|
5
|
+
already_confirmed: "was already confirmed"
|
6
|
+
not_locked: "was not locked"
|
7
|
+
|
8
|
+
devise:
|
9
|
+
failure:
|
10
|
+
unauthenticated: 'You need to sign in or sign up before continuing.'
|
11
|
+
unconfirmed: 'You have to confirm your account before continuing.'
|
12
|
+
locked: 'Your account is locked.'
|
13
|
+
invalid: 'Invalid email or password.'
|
14
|
+
invalid_token: 'Invalid authentication token.'
|
15
|
+
timeout: 'Your session expired, please sign in again to continue.'
|
16
|
+
inactive: 'Your account was not activated yet.'
|
17
|
+
sessions:
|
18
|
+
signed_in: 'Signed in successfully.'
|
19
|
+
signed_out: 'Signed out successfully.'
|
20
|
+
passwords:
|
21
|
+
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
22
|
+
updated: 'Your password was changed successfully. You are now signed in.'
|
23
|
+
confirmations:
|
24
|
+
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
25
|
+
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
26
|
+
registrations:
|
27
|
+
signed_up: 'You have signed up successfully. If enabled, a confirmation was sent to your e-mail.'
|
28
|
+
updated: 'You updated your account successfully.'
|
29
|
+
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
30
|
+
unlocks:
|
31
|
+
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
32
|
+
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
33
|
+
mailer:
|
34
|
+
confirmation_instructions:
|
35
|
+
subject: 'Confirmation instructions'
|
36
|
+
reset_password_instructions:
|
37
|
+
subject: 'Reset password instructions'
|
38
|
+
unlock_instructions:
|
39
|
+
subject: 'Unlock Instructions'
|
data/cucumber.yml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<%
|
2
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
|
5
|
+
%>
|
6
|
+
default: <%= std_opts %> features
|
7
|
+
wip: --tags @wip:3 --wip features
|
8
|
+
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|
@@ -0,0 +1,44 @@
|
|
1
|
+
Feature: Manage users
|
2
|
+
In order to control who can access the Client Area and CMS a website administrator will be able to manage user accounts
|
3
|
+
|
4
|
+
Background:
|
5
|
+
Given I am signed in as a website_administrator
|
6
|
+
|
7
|
+
Scenario: List Users
|
8
|
+
Given 20 users exist
|
9
|
+
And I am on the users admin page
|
10
|
+
Then I should see a list of users
|
11
|
+
|
12
|
+
Scenario: Create a User
|
13
|
+
Given I am on the users admin page
|
14
|
+
When I follow "Create New User"
|
15
|
+
And I fill in the following:
|
16
|
+
| Name | Mr Spoon |
|
17
|
+
| Email | spoon@buttonmoon.com |
|
18
|
+
| Password | s3cur3 |
|
19
|
+
| Password confirmation | s3cur3 |
|
20
|
+
And press "Create"
|
21
|
+
Then the user should be able to sign in as "spoon@buttonmoon.com/s3cur3"
|
22
|
+
|
23
|
+
Scenario: Edit User information
|
24
|
+
Given a user exists with the attrubutes:
|
25
|
+
| name | Mr Spoon |
|
26
|
+
| email | spoon@buttonmoon.com |
|
27
|
+
| password | s3cur3 |
|
28
|
+
| password_confirmation | s3cur3 |
|
29
|
+
And I am on the users admin page
|
30
|
+
When I follow "Mr Spoon"
|
31
|
+
And I fill in "Email" with "spoon@hotmail.com"
|
32
|
+
And press "Update"
|
33
|
+
Then the user should be able to sign in as "spoon@hotmail.com/s3cur3"
|
34
|
+
|
35
|
+
|
36
|
+
Scenario: Delete a User
|
37
|
+
Given a user exists with the attrubutes:
|
38
|
+
| name | Mr Spoon |
|
39
|
+
| email | spoon@buttonmoon.com |
|
40
|
+
| password | s3cur3 |
|
41
|
+
| password_confirmation | s3cur3 |
|
42
|
+
And I am on the users admin page
|
43
|
+
When I follow "Delete" within "tr:contains('Mr Spoon')"
|
44
|
+
Then the user should not be able to sign in as "spoon@buttonmoon.com/s3cur3"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Given /^I am signed in(?: as an? (.*))?$/ do |role|
|
2
|
+
role ||= 'user'
|
3
|
+
role = role.strip
|
4
|
+
|
5
|
+
user = Factory(role)
|
6
|
+
Given %{I sign in as "#{user.email}/#{user.password}"}
|
7
|
+
end
|
8
|
+
|
9
|
+
Then /^I should see a list of users$/ do
|
10
|
+
page.should have_css('tbody tr', :count => 20)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Database
|
14
|
+
|
15
|
+
Given /^a user exists with the attrubutes:$/ do |fields|
|
16
|
+
user = Factory :user, fields.rows_hash
|
17
|
+
end
|
18
|
+
|
19
|
+
Given /^I sign in as a (.+)$/ do |role|
|
20
|
+
user = create_model(role).first
|
21
|
+
user.confirm_email!
|
22
|
+
Given %{I sign in as "#{user.email}\/#{user.password}"}
|
23
|
+
end
|
24
|
+
|
25
|
+
# Actions
|
26
|
+
|
27
|
+
When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
|
28
|
+
When %{I go to the sign in page}
|
29
|
+
And %{I fill in "user_email" with "#{email}"}
|
30
|
+
And %{I fill in "user_password" with "#{password}"}
|
31
|
+
And %{I press "Sign in"}
|
32
|
+
end
|
33
|
+
|
34
|
+
When /^I sign out$/ do
|
35
|
+
visit destroy_user_session_path
|
36
|
+
end
|
37
|
+
|
38
|
+
Then /^the user should (not )?be able to sign in as "(.*)\/(.*)"$/ do |yes_no, email, password|
|
39
|
+
Given %{I sign out}
|
40
|
+
And %{I sign in as "#{email}/#{password}"}
|
41
|
+
if yes_no.blank?
|
42
|
+
Then %{I should see "Signed in successfully"}
|
43
|
+
else
|
44
|
+
Then %{I should see "Invalid email or password."}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
@@ -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,49 @@
|
|
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("../../../spec/dummy/config/environment.rb", __FILE__)
|
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/web/tableish'
|
14
|
+
require 'cucumber/rspec/doubles'
|
15
|
+
|
16
|
+
require 'capybara/rails'
|
17
|
+
require 'capybara/cucumber'
|
18
|
+
require 'capybara/session'
|
19
|
+
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
20
|
+
# order to ease the transition to Capybara we set the default here. If you'd
|
21
|
+
# prefer to use XPath just remove this line and adjust any selectors in your
|
22
|
+
# steps to use the XPath syntax.
|
23
|
+
Capybara.default_selector = :css
|
24
|
+
|
25
|
+
# If you set this to false, any error raised from within your app will bubble
|
26
|
+
# up to your step definition and out to cucumber unless you catch it somewhere
|
27
|
+
# on the way. You can make Rails rescue errors and render error pages on a
|
28
|
+
# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
|
29
|
+
#
|
30
|
+
# If you set this to true, Rails will rescue all errors and render error
|
31
|
+
# pages, more or less in the same way your application would behave in the
|
32
|
+
# default production environment. It's not recommended to do this for all
|
33
|
+
# of your scenarios, as this makes it hard to discover errors in your application.
|
34
|
+
ActionController::Base.allow_rescue = false
|
35
|
+
|
36
|
+
# How to clean your database when transactions are turned off. See
|
37
|
+
# http://github.com/bmabey/database_cleaner for more info.
|
38
|
+
require 'database_cleaner'
|
39
|
+
require 'database_cleaner/cucumber'
|
40
|
+
DatabaseCleaner.strategy = :truncation
|
41
|
+
|
42
|
+
require 'factory_girl'
|
43
|
+
|
44
|
+
Factory.definition_file_paths = [
|
45
|
+
File.expand_path("../../../spec/factories", __FILE__)
|
46
|
+
]
|
47
|
+
Factory.find_definitions
|
48
|
+
|
49
|
+
require 'factory_girl/step_definitions'
|