gsterndale-warrant 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/README.textile +2 -2
  2. data/VERSION.yml +1 -1
  3. data/test/rails_root/config/environment.rb +0 -4
  4. data/test/rails_root/test/unit/post_test.rb +18 -0
  5. metadata +9 -104
  6. data/test/rails_root/vendor/gems/RedCloth-3.0.4/bin/redcloth +0 -3
  7. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/CHANGELOG +0 -160
  8. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/COPYING +0 -25
  9. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/README +0 -106
  10. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/REFERENCE +0 -216
  11. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/make.rb +0 -359
  12. data/test/rails_root/vendor/gems/RedCloth-3.0.4/lib/redcloth.rb +0 -1130
  13. data/test/rails_root/vendor/gems/RedCloth-3.0.4/run-tests.rb +0 -28
  14. data/test/rails_root/vendor/gems/RedCloth-3.0.4/setup.rb +0 -1376
  15. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/code.yml +0 -105
  16. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/hard_breaks.yml +0 -26
  17. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/images.yml +0 -171
  18. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/instiki.yml +0 -39
  19. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/links.yml +0 -155
  20. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/lists.yml +0 -77
  21. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/markdown.yml +0 -218
  22. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/poignant.yml +0 -64
  23. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/table.yml +0 -198
  24. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/textism.yml +0 -406
  25. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/LICENSE +0 -21
  26. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/README.textile +0 -204
  27. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/Rakefile +0 -54
  28. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/TODO.textile +0 -8
  29. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/USAGE +0 -1
  30. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/clearance_generator.rb +0 -92
  31. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/lib/insert_commands.rb +0 -103
  32. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/lib/rake_commands.rb +0 -22
  33. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/README +0 -54
  34. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/application.rb +0 -5
  35. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/confirmations_controller.rb +0 -3
  36. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/passwords_controller.rb +0 -3
  37. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/sessions_controller.rb +0 -3
  38. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/users_controller.rb +0 -3
  39. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/models/clearance_mailer.rb +0 -5
  40. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/models/user.rb +0 -3
  41. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/clearance_mailer/change_password.html.erb +0 -10
  42. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/clearance_mailer/confirmation.html.erb +0 -1
  43. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/passwords/edit.html.erb +0 -25
  44. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/passwords/new.html.erb +0 -15
  45. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/sessions/new.html.erb +0 -28
  46. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/users/_form.html.erb +0 -13
  47. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/users/edit.html.erb +0 -6
  48. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/users/new.html.erb +0 -6
  49. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/db/migrate/create_users_with_clearance_columns.rb +0 -21
  50. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/db/migrate/update_users_with_clearance_columns.rb +0 -42
  51. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/factories/clearance.rb +0 -16
  52. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/confirmations_controller_test.rb +0 -5
  53. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/passwords_controller_test.rb +0 -5
  54. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/sessions_controller_test.rb +0 -5
  55. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/users_controller_test.rb +0 -5
  56. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/unit/clearance_mailer_test.rb +0 -6
  57. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/unit/user_test.rb +0 -5
  58. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance.rb +0 -14
  59. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/application_controller.rb +0 -82
  60. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/confirmations_controller.rb +0 -42
  61. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/passwords_controller.rb +0 -68
  62. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/sessions_controller.rb +0 -68
  63. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/users_controller.rb +0 -40
  64. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/models/clearance_mailer.rb +0 -29
  65. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/models/user.rb +0 -85
  66. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/confirmations_controller_test.rb +0 -44
  67. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/passwords_controller_test.rb +0 -175
  68. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/sessions_controller_test.rb +0 -194
  69. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/users_controller_test.rb +0 -85
  70. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/test_helper.rb +0 -28
  71. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/unit/clearance_mailer_test.rb +0 -65
  72. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/unit/user_test.rb +0 -163
  73. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/rails/init.rb +0 -1
  74. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/shoulda_macros/clearance.rb +0 -173
@@ -1,29 +0,0 @@
1
- module Clearance
2
- module App
3
- module Models
4
- module ClearanceMailer
5
-
6
- def self.included(mailer)
7
- mailer.class_eval do
8
-
9
- def change_password(user)
10
- from DO_NOT_REPLY
11
- recipients user.email
12
- subject "Change your password"
13
- body :user => user
14
- end
15
-
16
- def confirmation(user)
17
- from DO_NOT_REPLY
18
- recipients user.email
19
- subject "Account confirmation"
20
- body :user => user
21
- end
22
-
23
- end
24
- end
25
-
26
- end
27
- end
28
- end
29
- end
@@ -1,85 +0,0 @@
1
- require 'digest/sha2'
2
-
3
- module Clearance
4
- module App
5
- module Models
6
- module User
7
-
8
- def self.included(model)
9
- model.class_eval do
10
-
11
- attr_accessible :email, :password, :password_confirmation
12
- attr_accessor :password, :password_confirmation
13
-
14
- validates_presence_of :email
15
- validates_presence_of :password, :if => :password_required?
16
- validates_confirmation_of :password, :if => :password_required?
17
- validates_uniqueness_of :email, :case_sensitive => false
18
- validates_format_of :email, :with => %r{.+@.+\..+}
19
-
20
- before_save :initialize_salt, :encrypt_password, :downcase_email
21
-
22
- def self.authenticate(email, password)
23
- user = find(:first, :conditions => ['LOWER(email) = ?', email.to_s.downcase])
24
- user && user.authenticated?(password) ? user : nil
25
- end
26
-
27
- def authenticated?(password)
28
- encrypted_password == encrypt(password)
29
- end
30
-
31
- def encrypt(string)
32
- Digest::SHA512.hexdigest("--#{salt}--#{string}--")
33
- end
34
-
35
- def remember?
36
- remember_token_expires_at && Time.now.utc < remember_token_expires_at
37
- end
38
-
39
- def remember_me!
40
- remember_me_until 2.weeks.from_now.utc
41
- end
42
-
43
- def remember_me_until(time)
44
- self.update_attribute :remember_token_expires_at, time
45
- self.update_attribute :remember_token,
46
- encrypt("--#{remember_token_expires_at}--#{password}--")
47
- end
48
-
49
- def forget_me!
50
- self.update_attribute :remember_token_expires_at, nil
51
- self.update_attribute :remember_token, nil
52
- end
53
-
54
- def confirm_email!
55
- self.update_attribute :email_confirmed, true
56
- end
57
-
58
- protected
59
-
60
- def initialize_salt
61
- if new_record?
62
- self.salt = encrypt("--#{Time.now.utc.to_s}--#{password}--")
63
- end
64
- end
65
-
66
- def encrypt_password
67
- return if password.blank?
68
- self.encrypted_password = encrypt(password)
69
- end
70
-
71
- def password_required?
72
- encrypted_password.blank? || !password.blank?
73
- end
74
-
75
- def downcase_email
76
- self.email = email.to_s.downcase
77
- end
78
-
79
- end
80
- end
81
-
82
- end
83
- end
84
- end
85
- end
@@ -1,44 +0,0 @@
1
- module Clearance
2
- module Test
3
- module Functional
4
- module ConfirmationsControllerTest
5
-
6
- def self.included(controller_test)
7
- controller_test.class_eval do
8
-
9
- should_filter_params :salt
10
-
11
- context "Given a user whose email has not been confirmed" do
12
- setup { @user = Factory(:registered_user) }
13
-
14
- context "on GET to #new with correct id and salt" do
15
- setup do
16
- get :new, :user_id => @user.to_param, :salt => @user.salt
17
- end
18
-
19
- should_set_the_flash_to /confirmed email/i
20
- should_set_the_flash_to /signed in/i
21
- should_be_signed_in_and_email_confirmed_as { @user }
22
- should_redirect_to_url_after_create
23
- end
24
-
25
- context "on GET to #new with incorrect salt" do
26
- setup do
27
- salt = ""
28
- assert_not_equal salt, @user.salt
29
-
30
- get :new, :user_id => @user.to_param, :salt => salt
31
- end
32
-
33
- should_respond_with :not_found
34
- should_render_nothing
35
- end
36
- end
37
-
38
- end
39
- end
40
-
41
- end
42
- end
43
- end
44
- end
@@ -1,175 +0,0 @@
1
- module Clearance
2
- module Test
3
- module Functional
4
- module PasswordsControllerTest
5
-
6
- def self.included(controller_test)
7
- controller_test.class_eval do
8
-
9
- should_route :get, '/users/1/password/edit',
10
- :action => 'edit', :user_id => '1'
11
-
12
- context 'with a user' do
13
- setup { @user = Factory(:registered_user) }
14
-
15
- context 'A GET to #new' do
16
- setup { get :new, :user_id => @user.to_param }
17
-
18
- should_respond_with :success
19
- should_render_template "new"
20
- end
21
-
22
- context "A POST to #create" do
23
- context "with an existing user's email address" do
24
- setup do
25
- ActionMailer::Base.deliveries.clear
26
-
27
- post :create, :password => { :email => @user.email }
28
- end
29
-
30
- should "send the change your password email" do
31
- assert_sent_email do |email|
32
- email.subject =~ /change your password/i
33
- end
34
- end
35
-
36
- should "set a :notice flash with the user email address" do
37
- assert_match /#{@user.email}/, flash[:notice]
38
- end
39
-
40
- should_redirect_to_url_after_create
41
- end
42
-
43
- context "with a non-existent email address" do
44
- setup do
45
- email = "user1@example.com"
46
- assert ! User.exists?(['email = ?', email])
47
- ActionMailer::Base.deliveries.clear
48
-
49
- post :create, :password => { :email => email }
50
- end
51
-
52
- should "not send a password reminder email" do
53
- assert ActionMailer::Base.deliveries.empty?
54
- end
55
-
56
- should "set a :notice flash" do
57
- assert_not_nil flash.now[:notice]
58
- end
59
-
60
- should_render_template "new"
61
- end
62
- end
63
-
64
- context "A GET to #edit" do
65
- context "with an existing user's id and password" do
66
- setup do
67
- get :edit,
68
- :user_id => @user.to_param,
69
- :password => @user.encrypted_password,
70
- :email => @user.email
71
- end
72
-
73
- should "find the user with the given id and password" do
74
- assert_equal @user, assigns(:user)
75
- end
76
-
77
- should_respond_with :success
78
- should_render_template "edit"
79
-
80
- should "have a form for the user's email, password, and password confirm" do
81
- update_path = ERB::Util.h(user_password_path(@user,
82
- :password => @user.encrypted_password,
83
- :email => @user.email))
84
-
85
- assert_select 'form[action=?]', update_path do
86
- assert_select 'input[name=_method][value=?]', 'put'
87
- assert_select 'input[name=?]', 'user[password]'
88
- assert_select 'input[name=?]', 'user[password_confirmation]'
89
- end
90
- end
91
- end
92
-
93
- context "with an existing user's id but not password" do
94
- setup do
95
- get :edit, :user_id => @user.to_param, :password => ""
96
- end
97
-
98
- should_respond_with :not_found
99
- should_render_nothing
100
- end
101
- end
102
-
103
- context "A PUT to #update" do
104
- context "with an existing user's id but not password" do
105
- setup do
106
- put :update, :user_id => @user.to_param, :password => ""
107
- end
108
-
109
- should "not update the user's password" do
110
- assert_not_equal @encrypted_new_password, @user.encrypted_password
111
- end
112
-
113
- should_not_be_signed_in
114
- should_respond_with :not_found
115
- should_render_nothing
116
- end
117
-
118
- context "with a matching password and password confirmation" do
119
- setup do
120
- new_password = "new_password"
121
- @encrypted_new_password = @user.encrypt(new_password)
122
- assert_not_equal @encrypted_new_password, @user.encrypted_password
123
-
124
- put(:update,
125
- :user_id => @user,
126
- :email => @user.email,
127
- :password => @user.encrypted_password,
128
- :user => {
129
- :password => new_password,
130
- :password_confirmation => new_password
131
- })
132
- @user.reload
133
- end
134
-
135
- should "update the user's password" do
136
- assert_equal @encrypted_new_password, @user.encrypted_password
137
- end
138
-
139
- should_be_signed_in_as { @user }
140
- should_redirect_to_url_after_update
141
- end
142
-
143
- context "with password but blank password confirmation" do
144
- setup do
145
- new_password = "new_password"
146
- @encrypted_new_password = @user.encrypt(new_password)
147
-
148
- put(:update,
149
- :user_id => @user.to_param,
150
- :password => @user.encrypted_password,
151
- :user => {
152
- :password => new_password,
153
- :password_confirmation => ''
154
- })
155
- @user.reload
156
- end
157
-
158
- should "not update the user's password" do
159
- assert_not_equal @encrypted_new_password, @user.encrypted_password
160
- end
161
-
162
- should_not_be_signed_in
163
- should_respond_with :not_found
164
- should_render_nothing
165
- end
166
- end
167
- end
168
-
169
- end
170
- end
171
-
172
- end
173
- end
174
- end
175
- end
@@ -1,194 +0,0 @@
1
- module Clearance
2
- module Test
3
- module Functional
4
- module SessionsControllerTest
5
-
6
- def self.included(controller_test)
7
- controller_test.class_eval do
8
-
9
- should_filter_params :password
10
-
11
- context "on GET to /sessions/new" do
12
- setup { get :new }
13
-
14
- should_respond_with :success
15
- should_render_template :new
16
- should_not_set_the_flash
17
-
18
- should 'display a "sign in" form' do
19
- assert_select "form[action=#{session_path}][method=post]",
20
- true, "There must be a form to sign in" do
21
- assert_select "input[type=text][name=?]",
22
- "session[email]", true, "There must be an email field"
23
- assert_select "input[type=password][name=?]",
24
- "session[password]", true, "There must be a password field"
25
- assert_select "input[type=checkbox][name=?]",
26
- "session[remember_me]", true, "There must be a 'remember me' check box"
27
- assert_select "input[type=submit]", true,
28
- "There must be a submit button"
29
- end
30
- end
31
- end
32
-
33
- context "Given a registered user" do
34
- setup { @user = Factory(:registered_user) }
35
-
36
- context "a POST to #create with good credentials" do
37
- setup do
38
- ActionMailer::Base.deliveries.clear
39
- post :create, :session => {
40
- :email => @user.email,
41
- :password => @user.password }
42
- end
43
-
44
- should_deny_access(:flash => /confirm/i)
45
- end
46
- end
47
-
48
- context "Given an email confirmed user" do
49
- setup { @user = Factory(:email_confirmed_user) }
50
-
51
- context "a POST to #create with good credentials" do
52
- setup do
53
- post :create, :session => {
54
- :email => @user.email,
55
- :password => @user.password }
56
- end
57
-
58
- should_set_the_flash_to /success/i
59
- should_redirect_to_url_after_create
60
- should_be_signed_in_as { @user }
61
- end
62
-
63
- context "a POST to #create with bad credentials" do
64
- setup do
65
- post :create, :session => {
66
- :email => @user.email,
67
- :password => "bad value" }
68
- end
69
-
70
- should_set_the_flash_to /bad/i
71
- should_render_template :new
72
- should_not_be_signed_in
73
- end
74
-
75
- context "a POST to #create with good credentials and remember me" do
76
- setup do
77
- post :create, :session => {
78
- :email => @user.email,
79
- :password => @user.password,
80
- :remember_me => '1' }
81
- end
82
-
83
- should_set_the_flash_to /success/i
84
- should_redirect_to_url_after_create
85
- should_be_signed_in_as { @user }
86
-
87
- should 'set the cookie' do
88
- assert ! cookies['remember_token'].empty?
89
- end
90
-
91
- should 'set the remember me token in users table' do
92
- assert_not_nil @user.reload.remember_token
93
- assert_not_nil @user.reload.remember_token_expires_at
94
- end
95
- end
96
-
97
- context "a POST to #create with bad credentials and remember me" do
98
- setup do
99
- post :create, :session => {
100
- :email => @user.email,
101
- :password => "bad value",
102
- :remember_me => '1' }
103
- end
104
-
105
- should_set_the_flash_to /bad/i
106
- should_render_template :new
107
- should_return_from_session :user_id, "nil"
108
-
109
- should 'not create the cookie' do
110
- assert_nil cookies['remember_token']
111
- end
112
-
113
- should 'not set the remember me token in users table' do
114
- assert_nil @user.reload.remember_token
115
- assert_nil @user.reload.remember_token_expires_at
116
- end
117
- end
118
-
119
- context "a POST to #create with good credentials and A URL to return back" do
120
- context "in the session" do
121
- setup do
122
- @request.session[:return_to] = '/url_in_the_session'
123
- post :create, :session => {
124
- :email => @user.email,
125
- :password => @user.password }
126
- end
127
-
128
- should_redirect_to "'/url_in_the_session'"
129
- end
130
-
131
- context "in the request" do
132
- setup do
133
- post :create, :session => {
134
- :email => @user.email,
135
- :password => @user.password },
136
- :return_to => '/url_in_the_request'
137
- end
138
-
139
- should_redirect_to "'/url_in_the_request'"
140
- end
141
-
142
- context "in the request and in the session" do
143
- setup do
144
- @request.session[:return_to] = '/url_in_the_session'
145
- post :create, :session => {
146
- :email => @user.email,
147
- :password => @user.password },
148
- :return_to => '/url_in_the_request'
149
- end
150
-
151
- should_redirect_to "'/url_in_the_session'"
152
- end
153
- end
154
- end
155
-
156
- public_context do
157
- context "logging out again" do
158
- setup { delete :destroy }
159
- should_redirect_to_url_after_destroy
160
- end
161
- end
162
-
163
- signed_in_user_context do
164
- context "a DELETE to #destroy without a cookie" do
165
- setup { delete :destroy }
166
-
167
- should_set_the_flash_to(/signed out/i)
168
- should_redirect_to_url_after_destroy
169
- end
170
-
171
- context 'a DELETE to #destroy with a cookie' do
172
- setup do
173
- cookies['remember_token'] = CGI::Cookie.new 'token', 'value'
174
- delete :destroy
175
- end
176
-
177
- should 'delete the cookie' do
178
- assert cookies['remember_token'].empty?
179
- end
180
-
181
- should 'delete the remember me token in users table' do
182
- assert_nil @user.reload.remember_token
183
- assert_nil @user.reload.remember_token_expires_at
184
- end
185
- end
186
- end
187
-
188
- end
189
- end
190
-
191
- end
192
- end
193
- end
194
- end