rules_engine_users 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +22 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +47 -0
- data/VERSION +1 -0
- data/init.rb +1 -0
- data/lib/rules_engine/controller_user_mail.rb +29 -0
- data/lib/rules_engine/controller_users.rb +170 -0
- data/lib/rules_engine_users.rb +4 -0
- data/rails_generators/USAGE +97 -0
- data/rails_generators/manifests/rules_engine_users.rb +79 -0
- data/rails_generators/manifests/rules_engine_users.yml +32 -0
- data/rails_generators/rules_engine_users_generator.rb +21 -0
- data/rails_generators/templates/app/controllers/admin/users_controller.rb +64 -0
- data/rails_generators/templates/app/controllers/users_controller.rb +215 -0
- data/rails_generators/templates/app/models/user.rb +113 -0
- data/rails_generators/templates/app/models/user_mailer.rb +26 -0
- data/rails_generators/templates/app/models/user_observer.rb +19 -0
- data/rails_generators/templates/app/views/admin/users/_form.html.erb +6 -0
- data/rails_generators/templates/app/views/admin/users/edit.html.erb +18 -0
- data/rails_generators/templates/app/views/admin/users/index.html.erb +52 -0
- data/rails_generators/templates/app/views/admin/users/new.html.erb +17 -0
- data/rails_generators/templates/app/views/admin/users/show.html.erb +15 -0
- data/rails_generators/templates/app/views/user_mailer/forgot_password.html.erb +11 -0
- data/rails_generators/templates/app/views/user_mailer/welcome_message.html.erb +11 -0
- data/rails_generators/templates/app/views/users/change_form.html.erb +22 -0
- data/rails_generators/templates/app/views/users/details.html.erb +11 -0
- data/rails_generators/templates/app/views/users/login_form.html.erb +35 -0
- data/rails_generators/templates/app/views/users/pswd_change_form.html.erb +20 -0
- data/rails_generators/templates/app/views/users/pswd_forgot_form.html.erb +18 -0
- data/rails_generators/templates/app/views/users/pswd_reset_form.html.erb +22 -0
- data/rails_generators/templates/app/views/users/welcome_form.html.erb +21 -0
- data/rails_generators/templates/db/migrate/20100104014507_create_users.rb +41 -0
- data/rails_generators/templates/doc/README.rules_engine_users +122 -0
- data/rails_generators/templates/doc/README.rules_engine_users_paths +12 -0
- data/rails_generators/templates/features/admin/user/edit.feature +46 -0
- data/rails_generators/templates/features/admin/user/index.feature +78 -0
- data/rails_generators/templates/features/admin/user/new.feature +26 -0
- data/rails_generators/templates/features/admin/user/show.feature +22 -0
- data/rails_generators/templates/features/admin/user/step_definitions/edit_steps.rb +3 -0
- data/rails_generators/templates/features/admin/user/step_definitions/index_steps.rb +13 -0
- data/rails_generators/templates/features/admin/user/step_definitions/show_steps.rb +3 -0
- data/rails_generators/templates/features/support/blueprint_users.rb +14 -0
- data/rails_generators/templates/features/user/change.feature +37 -0
- data/rails_generators/templates/features/user/details.feature +15 -0
- data/rails_generators/templates/features/user/login.feature +65 -0
- data/rails_generators/templates/features/user/pswd_change.feature +46 -0
- data/rails_generators/templates/features/user/pswd_forgot.feature +32 -0
- data/rails_generators/templates/features/user/pswd_reset.feature +52 -0
- data/rails_generators/templates/features/user/step_definitions/login_steps.rb +46 -0
- data/rails_generators/templates/features/user/step_definitions/pswd_reset_steps.rb +15 -0
- data/rails_generators/templates/features/user/step_definitions/welcome_steps.rb +15 -0
- data/rails_generators/templates/features/user/welcome.feature +52 -0
- data/rails_generators/templates/spec/controllers/admin/users_controller_spec.rb +191 -0
- data/rails_generators/templates/spec/controllers/users_controller_spec.rb +579 -0
- data/rails_generators/templates/spec/models/user_mailer_spec.rb +39 -0
- data/rails_generators/templates/spec/models/user_observer_spec.rb +56 -0
- data/rails_generators/templates/spec/models/user_spec.rb +253 -0
- data/rails_generators/templates/spec/support/rules_engine_macros.rb +16 -0
- data/rules_engine_users.gemspec +141 -0
- data/spec/railsenv/app/controllers/application_controller.rb +10 -0
- data/spec/railsenv/config/boot.rb +110 -0
- data/spec/railsenv/config/database.yml +22 -0
- data/spec/railsenv/config/environment.rb +41 -0
- data/spec/railsenv/config/environments/development.rb +17 -0
- data/spec/railsenv/config/environments/production.rb +28 -0
- data/spec/railsenv/config/environments/test.rb +28 -0
- data/spec/railsenv/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/railsenv/config/initializers/inflections.rb +10 -0
- data/spec/railsenv/config/initializers/mime_types.rb +5 -0
- data/spec/railsenv/config/initializers/new_rails_defaults.rb +19 -0
- data/spec/railsenv/config/initializers/session_store.rb +15 -0
- data/spec/railsenv/config/locales/en.yml +5 -0
- data/spec/railsenv/config/routes.rb +43 -0
- data/spec/railsenv/db/test.sqlite3 +1 -0
- data/spec/railsenv/log/debug.log +1 -0
- data/spec/railsenv/log/test.log +1 -0
- data/spec/rcov.opts +3 -0
- data/spec/rules_engine/controller_user_mail_spec.rb +43 -0
- data/spec/rules_engine/controller_users_spec.rb +337 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +30 -0
- data/tasks/rspec.rake +18 -0
- metadata +180 -0
@@ -0,0 +1,253 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe User do
|
4
|
+
def valid_attributes
|
5
|
+
{
|
6
|
+
:full_name => 'Test User Name',
|
7
|
+
:email => 'Test@UserName.com',
|
8
|
+
:login => 'test',
|
9
|
+
:time_zone => "WOW",
|
10
|
+
|
11
|
+
:phone => "0408 505 1234",
|
12
|
+
|
13
|
+
:password => 'test_password',
|
14
|
+
:password_confirmation => 'test_password',
|
15
|
+
:access_level => User::ACCESS_LEVEL_DISABLED
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should accept valid attributes" do
|
20
|
+
User.new(valid_attributes).should be_valid
|
21
|
+
end
|
22
|
+
|
23
|
+
should_validate_presence_of :full_name
|
24
|
+
should_validate_presence_of :email
|
25
|
+
should_validate_presence_of :login
|
26
|
+
should_validate_presence_of :time_zone
|
27
|
+
|
28
|
+
describe "unique attributes" do
|
29
|
+
before(:each) do
|
30
|
+
User.create!(valid_attributes)
|
31
|
+
end
|
32
|
+
|
33
|
+
should_validate_uniqueness_of :email, :case_sensitive => false, :message=>"alread taken."
|
34
|
+
should_validate_uniqueness_of :login, :case_sensitive => false, :message=>"alread taken."
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should require a password confirmation when password set" do
|
38
|
+
user = User.new(valid_attributes.merge(:password_confirmation => '1'))
|
39
|
+
user.should_not be_valid
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should validate the password length as 4 characters" do
|
43
|
+
user = User.new(valid_attributes.merge(:password => '123', :password_confirmation => '123'))
|
44
|
+
user.should_not be_valid
|
45
|
+
|
46
|
+
user = User.new(valid_attributes.merge(:password => '1234', :password_confirmation => '1234'))
|
47
|
+
user.should be_valid
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "password encryption" do
|
51
|
+
it "should encrypt the password before saving" do
|
52
|
+
user = User.new(valid_attributes)
|
53
|
+
user.crypted_password.should be_blank #receive(:make_encrypted_password)
|
54
|
+
user.save(false)
|
55
|
+
user.crypted_password.should_not be_blank
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should only change the encrypt password if it the password is set" do
|
59
|
+
user = User.create(valid_attributes)
|
60
|
+
pswd = user.crypted_password
|
61
|
+
pswd.should_not be_blank
|
62
|
+
user.password = nil
|
63
|
+
|
64
|
+
user.save(false)
|
65
|
+
user.crypted_password.should == pswd
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should only change the encrypt password if it the password changed" do
|
69
|
+
user = User.create(valid_attributes)
|
70
|
+
pswd = user.crypted_password
|
71
|
+
pswd.should_not be_blank
|
72
|
+
user.password = 'silly_password_change'
|
73
|
+
# user.password_confirmation = 'silly_password_change'
|
74
|
+
|
75
|
+
user.save(false)
|
76
|
+
user.crypted_password.should_not == pswd
|
77
|
+
user.crypted_password.should_not be_blank
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "authenticate by email" do
|
82
|
+
it "should fail if the email not found " do
|
83
|
+
# user = User.create(valid_attributes)
|
84
|
+
User.destroy_all
|
85
|
+
User.authenticate_by_email(valid_attributes[:email], valid_attributes[:password]).should == nil
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should fail if the passwords do not match" do
|
89
|
+
user = User.create(valid_attributes)
|
90
|
+
User.authenticate_by_email(valid_attributes[:email], valid_attributes[:password] + '_wrong').should == nil
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should pass if email and password match" do
|
94
|
+
user = User.create(valid_attributes)
|
95
|
+
User.authenticate_by_email(valid_attributes[:email], valid_attributes[:password]).should == user
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "authenticate by login" do
|
100
|
+
it "should fail if the login not found " do
|
101
|
+
# user = User.create(valid_attributes)
|
102
|
+
User.destroy_all
|
103
|
+
User.authenticate_by_login(valid_attributes[:login], valid_attributes[:password]).should == nil
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should fail if the passwords do not match" do
|
107
|
+
user = User.create(valid_attributes)
|
108
|
+
User.authenticate_by_login(valid_attributes[:login], valid_attributes[:password] + '_wrong').should == nil
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should pass if login and password match" do
|
112
|
+
user = User.create(valid_attributes)
|
113
|
+
User.authenticate_by_login(valid_attributes[:login], valid_attributes[:password]).should == user
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
describe "authenticate_by_remember_token" do
|
119
|
+
it "should fail if the remember_token not found " do
|
120
|
+
User.destroy_all
|
121
|
+
User.authenticate_by_remember_token('invalid_token').should == nil
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should fail if the remember_token has expired" do
|
125
|
+
user = User.create(valid_attributes)
|
126
|
+
now = Time.now
|
127
|
+
|
128
|
+
Time.stub(:now).and_return(now - 31.days)
|
129
|
+
user.set_remember_token
|
130
|
+
|
131
|
+
Time.stub(:now).and_return(now)
|
132
|
+
User.authenticate_by_remember_token(user.remember_token).should == nil
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should pass if remember token valid" do
|
136
|
+
user = User.create(valid_attributes)
|
137
|
+
user.set_remember_token
|
138
|
+
User.authenticate_by_remember_token(user.remember_token).should == user
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe "authenticate_by_reset_token" do
|
143
|
+
it "should fail if the reset_token not found " do
|
144
|
+
User.destroy_all
|
145
|
+
User.authenticate_by_reset_token('invalid_token').should == nil
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should fail if the reset_token has expired" do
|
149
|
+
user = User.create(valid_attributes)
|
150
|
+
now = Time.now
|
151
|
+
|
152
|
+
Time.stub(:now).and_return(now - 3.days)
|
153
|
+
User.set_reset_token(user.email)
|
154
|
+
user.reload
|
155
|
+
|
156
|
+
Time.stub(:now).and_return(now)
|
157
|
+
User.authenticate_by_reset_token(user.reset_token).should == nil
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should pass if reset token valid" do
|
161
|
+
user = User.create(valid_attributes)
|
162
|
+
User.set_reset_token(user.email)
|
163
|
+
user.reload
|
164
|
+
|
165
|
+
User.authenticate_by_reset_token(user.reset_token).should == user
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "set remember token" do
|
170
|
+
it "should set the remember token to expire in 30 days (UTC)" do
|
171
|
+
now = Time.now
|
172
|
+
Time.stub(:now).and_return(now)
|
173
|
+
|
174
|
+
user = User.create(valid_attributes)
|
175
|
+
user.set_remember_token
|
176
|
+
user.remember_token_expires_at.should == 30.days.from_now.utc
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should create a remember token" do
|
180
|
+
user = User.create(valid_attributes)
|
181
|
+
user.set_remember_token
|
182
|
+
user.remember_token.should_not be_blank
|
183
|
+
end
|
184
|
+
|
185
|
+
it "should save the updated user to the database" do
|
186
|
+
user = User.create(valid_attributes)
|
187
|
+
user.should_receive(:save)
|
188
|
+
user.set_remember_token
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe "reset remember token" do
|
193
|
+
it "should reset the remember token and expiry" do
|
194
|
+
user = User.create(valid_attributes)
|
195
|
+
user.set_remember_token
|
196
|
+
user.remember_token_expires_at.should_not be_nil
|
197
|
+
user.remember_token.should_not be_nil
|
198
|
+
|
199
|
+
user.reset_remember_token
|
200
|
+
user.remember_token_expires_at.should be_nil
|
201
|
+
user.remember_token.should be_nil
|
202
|
+
end
|
203
|
+
|
204
|
+
it "should save the updated user to the database" do
|
205
|
+
user = User.create(valid_attributes)
|
206
|
+
user.should_receive(:save)
|
207
|
+
user.reset_remember_token
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
describe "set reset token" do
|
212
|
+
it "should return nil if the email was not found" do
|
213
|
+
User.set_reset_token('invalid_email_address').should be_nil
|
214
|
+
end
|
215
|
+
|
216
|
+
it "should return the user that has been reset" do
|
217
|
+
user = User.create(valid_attributes)
|
218
|
+
User.set_reset_token(user.email).should == user
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should set the reset token to expire in 2 days (UTC)" do
|
222
|
+
now = Time.now
|
223
|
+
Time.stub(:now).and_return(now)
|
224
|
+
|
225
|
+
user = User.create(valid_attributes)
|
226
|
+
User.set_reset_token(user.email).reset_token_expires_at.should == 2.days.from_now.utc
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should create a reset token" do
|
230
|
+
user = User.create(valid_attributes)
|
231
|
+
User.set_reset_token(user.email).reset_token.should_not be_blank
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should save the updated user to the database" do
|
235
|
+
user = User.create(valid_attributes)
|
236
|
+
User.stub(:find).and_return(user)
|
237
|
+
user.should_receive(:save)
|
238
|
+
|
239
|
+
User.set_reset_token(user.email)
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should clear the reset token when the password is updated" do
|
243
|
+
user = User.create(valid_attributes)
|
244
|
+
User.set_reset_token(user.email)
|
245
|
+
|
246
|
+
user.reload
|
247
|
+
user.reset_token.should_not be_blank
|
248
|
+
user.update_attributes(:password => 'new_password', :password_confirmation => 'new_password')
|
249
|
+
|
250
|
+
user.reset_token.should be_blank
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RulesEngineMacros
|
2
|
+
|
3
|
+
def it_should_require_rules_engine_reader_access(*action)
|
4
|
+
it "should require rules engine reader access for #{action[0]}" do
|
5
|
+
controller.should_receive(:rules_engine_reader_access_required)
|
6
|
+
get *action
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def it_should_require_rules_engine_editor_access(*action)
|
11
|
+
it "should require rules engine editor access for #{action[0]}" do
|
12
|
+
controller.should_receive(:rules_engine_editor_access_required)
|
13
|
+
get *action
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{rules_engine_users}
|
8
|
+
s.version = "0.0.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Chris Douglas"]
|
12
|
+
s.date = %q{2010-06-29}
|
13
|
+
s.description = %q{Manage users and authentication}
|
14
|
+
s.email = %q{dougo.chris@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".gitignore",
|
22
|
+
"LICENSE",
|
23
|
+
"README.rdoc",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"init.rb",
|
27
|
+
"lib/rules_engine/controller_user_mail.rb",
|
28
|
+
"lib/rules_engine/controller_users.rb",
|
29
|
+
"lib/rules_engine_users.rb",
|
30
|
+
"rails_generators/USAGE",
|
31
|
+
"rails_generators/manifests/rules_engine_users.rb",
|
32
|
+
"rails_generators/manifests/rules_engine_users.yml",
|
33
|
+
"rails_generators/rules_engine_users_generator.rb",
|
34
|
+
"rails_generators/templates/app/controllers/admin/users_controller.rb",
|
35
|
+
"rails_generators/templates/app/controllers/users_controller.rb",
|
36
|
+
"rails_generators/templates/app/models/user.rb",
|
37
|
+
"rails_generators/templates/app/models/user_mailer.rb",
|
38
|
+
"rails_generators/templates/app/models/user_observer.rb",
|
39
|
+
"rails_generators/templates/app/views/admin/users/_form.html.erb",
|
40
|
+
"rails_generators/templates/app/views/admin/users/edit.html.erb",
|
41
|
+
"rails_generators/templates/app/views/admin/users/index.html.erb",
|
42
|
+
"rails_generators/templates/app/views/admin/users/new.html.erb",
|
43
|
+
"rails_generators/templates/app/views/admin/users/show.html.erb",
|
44
|
+
"rails_generators/templates/app/views/user_mailer/forgot_password.html.erb",
|
45
|
+
"rails_generators/templates/app/views/user_mailer/welcome_message.html.erb",
|
46
|
+
"rails_generators/templates/app/views/users/change_form.html.erb",
|
47
|
+
"rails_generators/templates/app/views/users/details.html.erb",
|
48
|
+
"rails_generators/templates/app/views/users/login_form.html.erb",
|
49
|
+
"rails_generators/templates/app/views/users/pswd_change_form.html.erb",
|
50
|
+
"rails_generators/templates/app/views/users/pswd_forgot_form.html.erb",
|
51
|
+
"rails_generators/templates/app/views/users/pswd_reset_form.html.erb",
|
52
|
+
"rails_generators/templates/app/views/users/welcome_form.html.erb",
|
53
|
+
"rails_generators/templates/db/migrate/20100104014507_create_users.rb",
|
54
|
+
"rails_generators/templates/doc/README.rules_engine_users",
|
55
|
+
"rails_generators/templates/doc/README.rules_engine_users_paths",
|
56
|
+
"rails_generators/templates/features/admin/user/edit.feature",
|
57
|
+
"rails_generators/templates/features/admin/user/index.feature",
|
58
|
+
"rails_generators/templates/features/admin/user/new.feature",
|
59
|
+
"rails_generators/templates/features/admin/user/show.feature",
|
60
|
+
"rails_generators/templates/features/admin/user/step_definitions/edit_steps.rb",
|
61
|
+
"rails_generators/templates/features/admin/user/step_definitions/index_steps.rb",
|
62
|
+
"rails_generators/templates/features/admin/user/step_definitions/show_steps.rb",
|
63
|
+
"rails_generators/templates/features/support/blueprint_users.rb",
|
64
|
+
"rails_generators/templates/features/user/change.feature",
|
65
|
+
"rails_generators/templates/features/user/details.feature",
|
66
|
+
"rails_generators/templates/features/user/login.feature",
|
67
|
+
"rails_generators/templates/features/user/pswd_change.feature",
|
68
|
+
"rails_generators/templates/features/user/pswd_forgot.feature",
|
69
|
+
"rails_generators/templates/features/user/pswd_reset.feature",
|
70
|
+
"rails_generators/templates/features/user/step_definitions/login_steps.rb",
|
71
|
+
"rails_generators/templates/features/user/step_definitions/pswd_reset_steps.rb",
|
72
|
+
"rails_generators/templates/features/user/step_definitions/welcome_steps.rb",
|
73
|
+
"rails_generators/templates/features/user/welcome.feature",
|
74
|
+
"rails_generators/templates/spec/controllers/admin/users_controller_spec.rb",
|
75
|
+
"rails_generators/templates/spec/controllers/users_controller_spec.rb",
|
76
|
+
"rails_generators/templates/spec/models/user_mailer_spec.rb",
|
77
|
+
"rails_generators/templates/spec/models/user_observer_spec.rb",
|
78
|
+
"rails_generators/templates/spec/models/user_spec.rb",
|
79
|
+
"rails_generators/templates/spec/support/rules_engine_macros.rb",
|
80
|
+
"rules_engine_users.gemspec",
|
81
|
+
"spec/railsenv/app/controllers/application_controller.rb",
|
82
|
+
"spec/railsenv/config/boot.rb",
|
83
|
+
"spec/railsenv/config/database.yml",
|
84
|
+
"spec/railsenv/config/environment.rb",
|
85
|
+
"spec/railsenv/config/environments/development.rb",
|
86
|
+
"spec/railsenv/config/environments/production.rb",
|
87
|
+
"spec/railsenv/config/environments/test.rb",
|
88
|
+
"spec/railsenv/config/initializers/backtrace_silencers.rb",
|
89
|
+
"spec/railsenv/config/initializers/inflections.rb",
|
90
|
+
"spec/railsenv/config/initializers/mime_types.rb",
|
91
|
+
"spec/railsenv/config/initializers/new_rails_defaults.rb",
|
92
|
+
"spec/railsenv/config/initializers/session_store.rb",
|
93
|
+
"spec/railsenv/config/locales/en.yml",
|
94
|
+
"spec/railsenv/config/routes.rb",
|
95
|
+
"spec/railsenv/db/test.sqlite3",
|
96
|
+
"spec/railsenv/log/debug.log",
|
97
|
+
"spec/railsenv/log/test.log",
|
98
|
+
"spec/rcov.opts",
|
99
|
+
"spec/rules_engine/controller_user_mail_spec.rb",
|
100
|
+
"spec/rules_engine/controller_users_spec.rb",
|
101
|
+
"spec/spec.opts",
|
102
|
+
"spec/spec_helper.rb",
|
103
|
+
"tasks/rspec.rake"
|
104
|
+
]
|
105
|
+
s.homepage = %q{http://github.com/dougochris/rules_engine_users}
|
106
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
107
|
+
s.require_paths = ["lib"]
|
108
|
+
s.rubygems_version = %q{1.3.7}
|
109
|
+
s.summary = %q{Manage users and authentication}
|
110
|
+
s.test_files = [
|
111
|
+
"spec/railsenv/app/controllers/application_controller.rb",
|
112
|
+
"spec/railsenv/config/boot.rb",
|
113
|
+
"spec/railsenv/config/environment.rb",
|
114
|
+
"spec/railsenv/config/environments/development.rb",
|
115
|
+
"spec/railsenv/config/environments/production.rb",
|
116
|
+
"spec/railsenv/config/environments/test.rb",
|
117
|
+
"spec/railsenv/config/initializers/backtrace_silencers.rb",
|
118
|
+
"spec/railsenv/config/initializers/inflections.rb",
|
119
|
+
"spec/railsenv/config/initializers/mime_types.rb",
|
120
|
+
"spec/railsenv/config/initializers/new_rails_defaults.rb",
|
121
|
+
"spec/railsenv/config/initializers/session_store.rb",
|
122
|
+
"spec/railsenv/config/routes.rb",
|
123
|
+
"spec/rules_engine/controller_user_mail_spec.rb",
|
124
|
+
"spec/rules_engine/controller_users_spec.rb",
|
125
|
+
"spec/spec_helper.rb"
|
126
|
+
]
|
127
|
+
|
128
|
+
if s.respond_to? :specification_version then
|
129
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
130
|
+
s.specification_version = 3
|
131
|
+
|
132
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
133
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
134
|
+
else
|
135
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
136
|
+
end
|
137
|
+
else
|
138
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
7
|
+
|
8
|
+
# Scrub sensitive parameters from your log
|
9
|
+
# filter_parameter_logging :password
|
10
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class GemBoot < Boot
|
52
|
+
def load_initializer
|
53
|
+
self.class.load_rubygems
|
54
|
+
load_rails_gem
|
55
|
+
require 'initializer'
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_rails_gem
|
59
|
+
if version = self.class.gem_version
|
60
|
+
gem 'rails', version
|
61
|
+
else
|
62
|
+
gem 'rails'
|
63
|
+
end
|
64
|
+
rescue Gem::LoadError => load_error
|
65
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
+
exit 1
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
def rubygems_version
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def gem_version
|
75
|
+
if defined? RAILS_GEM_VERSION
|
76
|
+
RAILS_GEM_VERSION
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
79
|
+
else
|
80
|
+
parse_gem_version(read_environment_rb)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def load_rubygems
|
85
|
+
require 'rubygems'
|
86
|
+
min_version = '1.3.1'
|
87
|
+
unless rubygems_version >= min_version
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue LoadError
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
+
exit 1
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_gem_version(text)
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def read_environment_rb
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# All that for this:
|
110
|
+
Rails.boot!
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
4
|
+
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
|
5
|
+
|
6
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
7
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
8
|
+
|
9
|
+
Rails::Initializer.run do |config|
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Add additional load paths for your own custom dirs
|
15
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
16
|
+
|
17
|
+
# Specify gems that this application depends on and have them installed with rake gems:install
|
18
|
+
# config.gem "bj"
|
19
|
+
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
20
|
+
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
21
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Skip frameworks you're not going to use. To use Rails without a database,
|
28
|
+
# you must remove the Active Record framework.
|
29
|
+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
30
|
+
|
31
|
+
# Activate observers that should always be running
|
32
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
33
|
+
|
34
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
35
|
+
# Run "rake -D time" for a list of tasks for finding time zone names.
|
36
|
+
config.time_zone = 'UTC'
|
37
|
+
|
38
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
39
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
40
|
+
# config.i18n.default_locale = :de
|
41
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
13
|
+
config.action_view.debug_rjs = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.action_controller.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
config.action_view.cache_template_loading = true
|
11
|
+
|
12
|
+
# See everything in the log (default is :info)
|
13
|
+
# config.log_level = :debug
|
14
|
+
|
15
|
+
# Use a different logger for distributed setups
|
16
|
+
# config.logger = SyslogLogger.new
|
17
|
+
|
18
|
+
# Use a different cache store in production
|
19
|
+
# config.cache_store = :mem_cache_store
|
20
|
+
|
21
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
22
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
23
|
+
|
24
|
+
# Disable delivery errors, bad email addresses will be ignored
|
25
|
+
# config.action_mailer.raise_delivery_errors = false
|
26
|
+
|
27
|
+
# Enable threaded mode
|
28
|
+
# config.threadsafe!
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
config.action_view.cache_template_loading = true
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|