clearance 0.11.1 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of clearance might be problematic. Click here for more details.

Files changed (40) hide show
  1. data/.gitignore +4 -2
  2. data/Appraisals +11 -0
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +12 -10
  5. data/Gemfile.lock +101 -83
  6. data/README.md +23 -2
  7. data/Rakefile +9 -4
  8. data/VERSION +1 -1
  9. data/app/mailers/clearance_mailer.rb +5 -5
  10. data/app/views/clearance_mailer/change_password.html.erb +1 -3
  11. data/clearance.gemspec +1 -1
  12. data/features/engine/visitor_resets_password.feature +7 -4
  13. data/features/engine/visitor_signs_in.feature +10 -12
  14. data/features/engine/visitor_signs_out.feature +2 -4
  15. data/features/integration.feature +13 -14
  16. data/features/step_definitions/configuration_steps.rb +6 -1
  17. data/features/step_definitions/engine/clearance_steps.rb +8 -17
  18. data/features/step_definitions/web_steps.rb +82 -90
  19. data/features/support/appraisal.rb +18 -0
  20. data/features/support/aruba.rb +3 -0
  21. data/features/support/clearance.rb +16 -0
  22. data/features/support/env.rb +40 -29
  23. data/features/support/selectors.rb +39 -0
  24. data/gemfiles/3.0.9.gemfile +18 -0
  25. data/gemfiles/3.0.9.gemfile.lock +176 -0
  26. data/gemfiles/3.1.0.rc4.gemfile +22 -0
  27. data/gemfiles/3.1.0.rc4.gemfile.lock +212 -0
  28. data/lib/clearance.rb +0 -1
  29. data/lib/clearance/test_matchers.rb +60 -0
  30. data/lib/clearance/user.rb +16 -4
  31. data/lib/generators/clearance/install/templates/README +6 -6
  32. data/spec/controllers/passwords_controller_spec.rb +4 -4
  33. data/spec/factories.rb +5 -5
  34. data/spec/spec_helper.rb +3 -47
  35. data/spec/support/clearance.rb +12 -0
  36. metadata +19 -8
  37. data/.bundle/config +0 -2
  38. data/lib/clearance/shoulda_macros.rb +0 -73
  39. data/spec/support/authorization.rb +0 -18
  40. data/spec/support/clearance_redirects.rb +0 -21
data/.gitignore CHANGED
@@ -4,5 +4,7 @@ pkg
4
4
  *.swo
5
5
  *~
6
6
  !.keep
7
- tmp
8
- *.sqlite3
7
+ .bundle
8
+ db/*.sqlite3
9
+ log/*.log
10
+ tmp/
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise "3.0.9" do
2
+ gem "rails", "3.0.9"
3
+ end
4
+
5
+ appraise "3.1.0.rc4" do
6
+ gem "rails", "3.1.0.rc4"
7
+ gem 'sass-rails'
8
+ gem 'coffee-script'
9
+ gem 'uglifier'
10
+ gem 'jquery-rails'
11
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ 0.11.2
2
+ -------------------
3
+
4
+ * Rails 3.1.rc compatible. (Prem Sichanugrist and Dan Croak)
5
+ * Cucumber features no longer require password. (Dan Croak)
6
+ * No more Clearance shoulda_macros. Instead providing RSpec- and Test::Unit-compliant test matchers (sign_in, sign_in_as, should deny_access, etc). (Dan Croak)
7
+
1
8
  0.11.1
2
9
  -------------------
3
10
 
data/Gemfile CHANGED
@@ -1,15 +1,17 @@
1
1
  source "http://rubygems.org"
2
- gem "aruba", "~> 0.2.7"
3
- gem "rake"
4
- gem "rails", ">= 3.0.7"
5
- gem "thin"
6
- gem "shoulda"
2
+
3
+ gem "rails", "3.0.9"
7
4
  gem "sqlite3"
8
- gem "factory_girl"
9
- gem "diesel"
10
- gem "cucumber-rails", '0.3.2'
11
- gem "capybara"
5
+
6
+ gem "diesel", :git => "git://github.com/thoughtbot/diesel.git"
7
+
8
+ gem "cucumber-rails", '1.0.0'
9
+ gem "capybara", "1.0.0"
12
10
  gem "factory_girl_rails"
13
- gem "rspec-rails"
11
+ gem "shoulda-matchers", :git => "git://github.com/thoughtbot/shoulda-matchers.git"
12
+ gem "database_cleaner"
13
+ gem "rspec-rails", "~> 2.6.0"
14
14
  gem "launchy"
15
15
  gem "mocha"
16
+ gem "appraisal", :git => "git://github.com/thoughtbot/appraisal.git"
17
+ gem "aruba", "~> 0.4.2"
data/Gemfile.lock CHANGED
@@ -1,13 +1,35 @@
1
+ GIT
2
+ remote: git://github.com/thoughtbot/appraisal.git
3
+ revision: f8029181543b4bc4bdea03735a3b1e558fd66501
4
+ specs:
5
+ appraisal (0.3.5)
6
+ aruba (~> 0.4.2)
7
+ bundler
8
+ rake
9
+
10
+ GIT
11
+ remote: git://github.com/thoughtbot/diesel.git
12
+ revision: f68a990573e2684bb4645a90876603de0a772b69
13
+ specs:
14
+ diesel (0.1.4)
15
+ railties
16
+
17
+ GIT
18
+ remote: git://github.com/thoughtbot/shoulda-matchers.git
19
+ revision: a922b8ec38b65ae3274f194e90eaff6ac642d0b1
20
+ specs:
21
+ shoulda-matchers (1.0.0.beta3)
22
+
1
23
  GEM
2
24
  remote: http://rubygems.org/
3
25
  specs:
4
26
  abstract (1.0.0)
5
- actionmailer (3.0.7)
6
- actionpack (= 3.0.7)
7
- mail (~> 2.2.15)
8
- actionpack (3.0.7)
9
- activemodel (= 3.0.7)
10
- activesupport (= 3.0.7)
27
+ actionmailer (3.0.9)
28
+ actionpack (= 3.0.9)
29
+ mail (~> 2.2.19)
30
+ actionpack (3.0.9)
31
+ activemodel (= 3.0.9)
32
+ activesupport (= 3.0.9)
11
33
  builder (~> 2.1.2)
12
34
  erubis (~> 2.6.6)
13
35
  i18n (~> 0.5.0)
@@ -15,65 +37,64 @@ GEM
15
37
  rack-mount (~> 0.6.14)
16
38
  rack-test (~> 0.5.7)
17
39
  tzinfo (~> 0.3.23)
18
- activemodel (3.0.7)
19
- activesupport (= 3.0.7)
40
+ activemodel (3.0.9)
41
+ activesupport (= 3.0.9)
20
42
  builder (~> 2.1.2)
21
43
  i18n (~> 0.5.0)
22
- activerecord (3.0.7)
23
- activemodel (= 3.0.7)
24
- activesupport (= 3.0.7)
25
- arel (~> 2.0.2)
44
+ activerecord (3.0.9)
45
+ activemodel (= 3.0.9)
46
+ activesupport (= 3.0.9)
47
+ arel (~> 2.0.10)
26
48
  tzinfo (~> 0.3.23)
27
- activeresource (3.0.7)
28
- activemodel (= 3.0.7)
29
- activesupport (= 3.0.7)
30
- activesupport (3.0.7)
31
- arel (2.0.9)
32
- aruba (0.2.8)
33
- childprocess (~> 0.1.6)
34
- cucumber (~> 0.10.0)
35
- rspec (~> 2.3.0)
49
+ activeresource (3.0.9)
50
+ activemodel (= 3.0.9)
51
+ activesupport (= 3.0.9)
52
+ activesupport (3.0.9)
53
+ arel (2.0.10)
54
+ aruba (0.4.3)
55
+ bcat (>= 0.6.1)
56
+ childprocess (>= 0.1.9)
57
+ cucumber (>= 0.10.7)
58
+ rdiscount (>= 1.6.8)
59
+ rspec (>= 2.6.0)
60
+ bcat (0.6.1)
61
+ rack (~> 1.0)
36
62
  builder (2.1.2)
37
- capybara (0.4.1.2)
38
- celerity (>= 0.7.9)
39
- culerity (>= 0.2.4)
63
+ capybara (1.0.0)
40
64
  mime-types (>= 1.16)
41
65
  nokogiri (>= 1.3.3)
42
66
  rack (>= 1.0.0)
43
67
  rack-test (>= 0.5.4)
44
- selenium-webdriver (>= 0.0.27)
45
- xpath (~> 0.1.3)
46
- celerity (0.8.9)
47
- childprocess (0.1.8)
68
+ selenium-webdriver (~> 0.2.0)
69
+ xpath (~> 0.1.4)
70
+ childprocess (0.1.9)
48
71
  ffi (~> 1.0.6)
49
- configuration (1.2.0)
50
- cucumber (0.10.2)
72
+ configuration (1.3.1)
73
+ cucumber (1.0.0)
51
74
  builder (>= 2.1.2)
52
75
  diff-lcs (>= 1.1.2)
53
- gherkin (>= 2.3.5)
76
+ gherkin (~> 2.4.1)
54
77
  json (>= 1.4.6)
55
78
  term-ansicolor (>= 1.0.5)
56
- cucumber-rails (0.3.2)
57
- cucumber (>= 0.8.0)
58
- culerity (0.2.15)
59
- daemons (1.1.3)
60
- diesel (0.1.4)
61
- railties (~> 3.0.3)
79
+ cucumber-rails (1.0.0)
80
+ capybara (>= 1.0.0)
81
+ cucumber (~> 1.0.0)
82
+ nokogiri (>= 1.4.4)
83
+ rack-test (>= 0.5.7)
84
+ database_cleaner (0.6.7)
62
85
  diff-lcs (1.1.2)
63
86
  erubis (2.6.6)
64
87
  abstract (>= 1.0.0)
65
- eventmachine (0.12.10)
66
88
  factory_girl (1.3.3)
67
89
  factory_girl_rails (1.0.1)
68
90
  factory_girl (~> 1.3)
69
91
  railties (>= 3.0.0)
70
- ffi (1.0.7)
71
- rake (>= 0.8.7)
72
- gherkin (2.3.6)
92
+ ffi (1.0.9)
93
+ gherkin (2.4.1)
73
94
  json (>= 1.4.6)
74
95
  i18n (0.5.0)
75
- json (1.5.1)
76
- json_pure (1.5.1)
96
+ json (1.5.3)
97
+ json_pure (1.5.3)
77
98
  launchy (0.4.0)
78
99
  configuration (>= 0.0.5)
79
100
  rake (>= 0.8.1)
@@ -84,57 +105,55 @@ GEM
84
105
  treetop (~> 1.4.8)
85
106
  mime-types (1.16)
86
107
  mocha (0.9.12)
87
- nokogiri (1.4.4)
108
+ nokogiri (1.4.6)
88
109
  polyglot (0.3.1)
89
- rack (1.2.2)
110
+ rack (1.2.3)
90
111
  rack-mount (0.6.14)
91
112
  rack (>= 1.0.0)
92
113
  rack-test (0.5.7)
93
114
  rack (>= 1.0)
94
- rails (3.0.7)
95
- actionmailer (= 3.0.7)
96
- actionpack (= 3.0.7)
97
- activerecord (= 3.0.7)
98
- activeresource (= 3.0.7)
99
- activesupport (= 3.0.7)
115
+ rails (3.0.9)
116
+ actionmailer (= 3.0.9)
117
+ actionpack (= 3.0.9)
118
+ activerecord (= 3.0.9)
119
+ activeresource (= 3.0.9)
120
+ activesupport (= 3.0.9)
100
121
  bundler (~> 1.0)
101
- railties (= 3.0.7)
102
- railties (3.0.7)
103
- actionpack (= 3.0.7)
104
- activesupport (= 3.0.7)
122
+ railties (= 3.0.9)
123
+ railties (3.0.9)
124
+ actionpack (= 3.0.9)
125
+ activesupport (= 3.0.9)
105
126
  rake (>= 0.8.7)
127
+ rdoc (~> 3.4)
106
128
  thor (~> 0.14.4)
107
- rake (0.8.7)
108
- rspec (2.3.0)
109
- rspec-core (~> 2.3.0)
110
- rspec-expectations (~> 2.3.0)
111
- rspec-mocks (~> 2.3.0)
112
- rspec-core (2.3.1)
113
- rspec-expectations (2.3.0)
129
+ rake (0.9.2)
130
+ rdiscount (1.6.8)
131
+ rdoc (3.7)
132
+ rspec (2.6.0)
133
+ rspec-core (~> 2.6.0)
134
+ rspec-expectations (~> 2.6.0)
135
+ rspec-mocks (~> 2.6.0)
136
+ rspec-core (2.6.4)
137
+ rspec-expectations (2.6.0)
114
138
  diff-lcs (~> 1.1.2)
115
- rspec-mocks (2.3.0)
116
- rspec-rails (2.3.1)
139
+ rspec-mocks (2.6.0)
140
+ rspec-rails (2.6.1)
117
141
  actionpack (~> 3.0)
118
142
  activesupport (~> 3.0)
119
143
  railties (~> 3.0)
120
- rspec (~> 2.3.0)
144
+ rspec (~> 2.6.0)
121
145
  rubyzip (0.9.4)
122
- selenium-webdriver (0.2.0)
123
- childprocess (>= 0.1.7)
146
+ selenium-webdriver (0.2.2)
147
+ childprocess (>= 0.1.9)
124
148
  ffi (>= 1.0.7)
125
149
  json_pure
126
150
  rubyzip
127
- shoulda (2.11.3)
128
151
  sqlite3 (1.3.3)
129
152
  term-ansicolor (1.0.5)
130
- thin (1.2.11)
131
- daemons (>= 1.0.9)
132
- eventmachine (>= 0.12.6)
133
- rack (>= 1.0.0)
134
153
  thor (0.14.6)
135
154
  treetop (1.4.9)
136
155
  polyglot (>= 0.3.1)
137
- tzinfo (0.3.27)
156
+ tzinfo (0.3.29)
138
157
  xpath (0.1.4)
139
158
  nokogiri (~> 1.3)
140
159
 
@@ -142,17 +161,16 @@ PLATFORMS
142
161
  ruby
143
162
 
144
163
  DEPENDENCIES
145
- aruba (~> 0.2.7)
146
- capybara
147
- cucumber-rails (= 0.3.2)
148
- diesel
149
- factory_girl
164
+ appraisal!
165
+ aruba (~> 0.4.2)
166
+ capybara (= 1.0.0)
167
+ cucumber-rails (= 1.0.0)
168
+ database_cleaner
169
+ diesel!
150
170
  factory_girl_rails
151
171
  launchy
152
172
  mocha
153
- rails (>= 3.0.7)
154
- rake
155
- rspec-rails
156
- shoulda
173
+ rails (= 3.0.9)
174
+ rspec-rails (~> 2.6.0)
175
+ shoulda-matchers!
157
176
  sqlite3
158
- thin
data/README.md CHANGED
@@ -17,7 +17,7 @@ Help
17
17
  Installation
18
18
  ------------
19
19
 
20
- Clearance is a Rails engine for Rails 3.
20
+ Clearance is a Rails engine for Rails 3. It is currently tested against Rails 3.0.9 and Rails 3.1.0.rc4.
21
21
 
22
22
  Include the gem in your Gemfile:
23
23
 
@@ -33,6 +33,8 @@ This:
33
33
  * inserts Clearance::Authentication into your ApplicationController
34
34
  * creates a migration that either creates a users table or adds only missing columns
35
35
 
36
+ Follow the instructions that are output from the generator.
37
+
36
38
  Use the [0.8.x](https://github.com/thoughtbot/clearance/tree/v0.8.8)
37
39
  series of Clearance if you have a Rails 2 app.
38
40
 
@@ -44,20 +46,30 @@ method in a before_filter.
44
46
 
45
47
  class WidgetsController < ApplicationController
46
48
  before_filter :authorize
49
+
47
50
  def index
48
51
  @widgets = Widget.all
49
52
  end
50
53
  end
51
54
 
55
+ If you want to reference the current user in a controller, view, or helper, use
56
+ the current_user method.
57
+
58
+ def index
59
+ current_user.articles
60
+ end
61
+
52
62
  Customizing
53
63
  -----------
54
64
 
55
- To change any of provided actions, subclass a Clearance controller...
65
+ If you ever need to change the logic in any of the four provided controllers,
66
+ subclass the Clearance controller. You don't need to do this by default.
56
67
 
57
68
  class SessionsController < Clearance::SessionsController
58
69
  def new
59
70
  # my special new action
60
71
  end
72
+
61
73
  def url_after_create
62
74
  my_special_path
63
75
  end
@@ -96,6 +108,15 @@ Then run your tests!
96
108
 
97
109
  rake
98
110
 
111
+ Optional test matchers
112
+ ----------------------
113
+
114
+ Clearance comes with test matchers that are compatible with RSpec and Test::Unit.
115
+
116
+ To use them, require the test matchers. For example, in spec/support/clearance.rb:
117
+
118
+ require 'clearance/shoulda_matchers'
119
+
99
120
  Extensions
100
121
  ----------
101
122
 
data/Rakefile CHANGED
@@ -7,6 +7,15 @@ require 'rake/gempackagetask'
7
7
  require 'cucumber/rake/task'
8
8
  require 'diesel/tasks'
9
9
  require 'rspec/core/rake_task'
10
+ require 'appraisal'
11
+
12
+ desc "Default: run the specs and cucumber features"
13
+ task :default => [:all]
14
+
15
+ desc 'Test the plugin under all supported Rails versions.'
16
+ task :all => ["appraisal:install"] do |t|
17
+ exec('rake appraisal spec cucumber')
18
+ end
10
19
 
11
20
  RSpec::Core::RakeTask.new do |t|
12
21
  t.pattern = 'spec/**/*_spec.rb'
@@ -16,7 +25,3 @@ Cucumber::Rake::Task.new(:cucumber) do |t|
16
25
  t.fork = true
17
26
  t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
18
27
  end
19
-
20
- desc "Default: run the specs and cucumber features"
21
- task :default => [:spec, :cucumber]
22
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.1
1
+ 0.11.2
@@ -1,10 +1,10 @@
1
1
  class ClearanceMailer < ActionMailer::Base
2
2
  def change_password(user)
3
3
  @user = user
4
- from Clearance.configuration.mailer_sender
5
- recipients @user.email
6
- subject I18n.t(:change_password,
7
- :scope => [:clearance, :models, :clearance_mailer],
8
- :default => "Change your password")
4
+ mail :from => Clearance.configuration.mailer_sender,
5
+ :to => @user.email,
6
+ :subject => I18n.t(:change_password,
7
+ :scope => [:clearance, :models, :clearance_mailer],
8
+ :default => "Change your password")
9
9
  end
10
10
  end
@@ -2,8 +2,6 @@ Someone, hopefully you, has requested that we send you a link to change your pas
2
2
 
3
3
  Here's the link:
4
4
 
5
- <%= edit_user_password_url(@user,
6
- :token => @user.confirmation_token,
7
- :escape => false) %>
5
+ <%= edit_user_password_url(@user, :token => @user.confirmation_token.html_safe) %>
8
6
 
9
7
  If you didn't request this, ignore this email. Don't worry. Your password hasn't been changed.
data/clearance.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.require_paths = ["lib"]
23
23
  s.rubygems_version = %q{1.3.7}
24
24
 
25
- s.add_dependency('rails', '~> 3.0.0')
25
+ s.add_dependency('rails', '>= 3.0')
26
26
  s.add_dependency('diesel', '~> 0.1.4')
27
27
 
28
28
  s.add_development_dependency('bundler', '~> 1.0.0')