clearance 0.11.2 → 0.12.0

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.

data/Appraisals CHANGED
@@ -8,4 +8,5 @@ appraise "3.1.0.rc4" do
8
8
  gem 'coffee-script'
9
9
  gem 'uglifier'
10
10
  gem 'jquery-rails'
11
+ gem 'turn'
11
12
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ 0.12.0
2
+ -------------------
3
+
4
+ * [#129] Denying access redirects to root_url when signed in, sign_in_url when signed out. (Dan Croak)
5
+ * New configuration setting: denied_access_url. (Dan Croak)
6
+ * Using flash :notice key everywhere now instead of :success and :failure. More in line with Rails conventions. (Dan Croak)
7
+ * [#149] redirect_back_or on sign up. (Dan Croak)
8
+ * [#147] Resetting password no longer redirects to sign in page. It displays a message telling them to look for an email. (Dan Croak)
9
+ * Removed redundant flash messages. ("Signed in.", "Signed out.", and "You are now signed up.") (Dan Croak)
10
+
1
11
  0.11.2
2
12
  -------------------
3
13
 
data/README.md CHANGED
@@ -62,6 +62,8 @@ the current_user method.
62
62
  Customizing
63
63
  -----------
64
64
 
65
+ Clearance is intended to be small, simple, well-tested, and easy to extend.
66
+
65
67
  If you ever need to change the logic in any of the four provided controllers,
66
68
  subclass the Clearance controller. You don't need to do this by default.
67
69
 
@@ -115,17 +117,33 @@ Clearance comes with test matchers that are compatible with RSpec and Test::Unit
115
117
 
116
118
  To use them, require the test matchers. For example, in spec/support/clearance.rb:
117
119
 
118
- require 'clearance/shoulda_matchers'
120
+ require 'clearance/testing'
119
121
 
120
- Extensions
121
- ----------
122
+ You'll then have access to methods like:
122
123
 
123
- Clearance is intended to be small, simple, well-tested, and easy to extend.
124
- Check out some of the ways people have extended Clearance:
124
+ sign_in
125
+ sign_in_as(user)
126
+ sign_out
127
+
128
+ And matchers like:
129
+
130
+ deny_access
131
+
132
+ Example:
125
133
 
126
- * [Clearance HTTP Auth](https://github.com/karmi/clearance_http_auth)
127
- * [Clearance Twitter](https://github.com/thoughtbot/clearance-twitter)
128
- * [Clearance Admin](https://github.com/xenda/clearance-admin)
134
+ context "a visitor" do
135
+ before { get :show }
136
+ it { should deny_access }
137
+ end
138
+
139
+ context "a user" do
140
+ before do
141
+ sign_in
142
+ get :show
143
+ end
144
+
145
+ it { should respond_with(:success) }
146
+ end
129
147
 
130
148
  Credits
131
149
  -------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.2
1
+ 0.12.0
@@ -13,8 +13,7 @@ class Clearance::PasswordsController < ApplicationController
13
13
  if user = ::User.find_by_email(params[:password][:email])
14
14
  user.forgot_password!
15
15
  ::ClearanceMailer.change_password(user).deliver
16
- flash_notice_after_create
17
- redirect_to(url_after_create)
16
+ render :template => 'passwords/create'
18
17
  else
19
18
  flash_failure_after_create
20
19
  render :template => 'passwords/new'
@@ -33,7 +32,6 @@ class Clearance::PasswordsController < ApplicationController
33
32
 
34
33
  if @user.update_password(params[:user][:password])
35
34
  sign_in(@user)
36
- flash_success_after_update
37
35
  redirect_to(url_after_update)
38
36
  else
39
37
  flash_failure_after_update
@@ -59,30 +57,19 @@ class Clearance::PasswordsController < ApplicationController
59
57
  end
60
58
 
61
59
  def flash_failure_when_forbidden
62
- flash.now[:failure] = translate(:forbidden,
60
+ flash.now[:notice] = translate(:forbidden,
63
61
  :scope => [:clearance, :controllers, :passwords],
64
62
  :default => "Please double check the URL or try submitting the form again.")
65
63
  end
66
64
 
67
- def flash_notice_after_create
68
- flash[:notice] = translate(:deliver_change_password,
69
- :scope => [:clearance, :controllers, :passwords],
70
- :default => "You will receive an email within the next few minutes. " <<
71
- "It contains instructions for changing your password.")
72
- end
73
-
74
65
  def flash_failure_after_create
75
- flash.now[:failure] = translate(:unknown_email,
66
+ flash.now[:notice] = translate(:unknown_email,
76
67
  :scope => [:clearance, :controllers, :passwords],
77
68
  :default => "Unknown email.")
78
69
  end
79
70
 
80
- def flash_success_after_update
81
- flash[:success] = translate(:signed_in, :default => "Signed in.")
82
- end
83
-
84
71
  def flash_failure_after_update
85
- flash.now[:failure] = translate(:blank_password,
72
+ flash.now[:notice] = translate(:blank_password,
86
73
  :scope => [:clearance, :controllers, :passwords],
87
74
  :default => "Password can't be blank.")
88
75
  end
@@ -15,37 +15,27 @@ class Clearance::SessionsController < ApplicationController
15
15
  render :template => 'sessions/new', :status => :unauthorized
16
16
  else
17
17
  sign_in(@user)
18
- flash_success_after_create
19
18
  redirect_back_or(url_after_create)
20
19
  end
21
20
  end
22
21
 
23
22
  def destroy
24
23
  sign_out
25
- flash_success_after_destroy
26
24
  redirect_to(url_after_destroy)
27
25
  end
28
26
 
29
27
  private
30
28
 
31
29
  def flash_failure_after_create
32
- flash.now[:failure] = translate(:bad_email_or_password,
30
+ flash.now[:notice] = translate(:bad_email_or_password,
33
31
  :scope => [:clearance, :controllers, :sessions],
34
32
  :default => "Bad email or password.")
35
33
  end
36
34
 
37
- def flash_success_after_create
38
- flash[:success] = translate(:signed_in, :default => "Signed in.")
39
- end
40
-
41
35
  def url_after_create
42
36
  '/'
43
37
  end
44
38
 
45
- def flash_success_after_destroy
46
- flash[:success] = translate(:signed_out, :default => "Signed out.")
47
- end
48
-
49
39
  def url_after_destroy
50
40
  sign_in_url
51
41
  end
@@ -13,8 +13,7 @@ class Clearance::UsersController < ApplicationController
13
13
  @user = ::User.new(params[:user])
14
14
  if @user.save
15
15
  sign_in(@user)
16
- flash_notice_after_create
17
- redirect_to(url_after_create)
16
+ redirect_back_or(url_after_create)
18
17
  else
19
18
  flash_failure_after_create
20
19
  render :template => 'users/new'
@@ -23,14 +22,8 @@ class Clearance::UsersController < ApplicationController
23
22
 
24
23
  private
25
24
 
26
- def flash_notice_after_create
27
- flash[:notice] = translate(:signed_up,
28
- :scope => [:clearance, :controllers, :users],
29
- :default => "You are now signed up.")
30
- end
31
-
32
25
  def flash_failure_after_create
33
- flash.now[:failure] = translate(:bad_email_or_password,
26
+ flash.now[:notice] = translate(:bad_email_or_password,
34
27
  :scope => [:clearance, :controllers, :passwords],
35
28
  :default => "Must be a valid email address. Password can't be blank.")
36
29
  end
@@ -0,0 +1,4 @@
1
+ <p>
2
+ You will receive an email within the next few minutes.
3
+ It contains instructions for changing your password.
4
+ </p>
@@ -25,12 +25,10 @@ Feature: Sign in
25
25
  When I go to the sign in page
26
26
  Then I should see an email field
27
27
  And I sign in as "email@example.com"
28
- Then I should see "Signed in"
29
- And I should be signed in
28
+ Then I should be signed in
30
29
 
31
30
  Scenario: Visitor signs in successfully with uppercase email
32
31
  Given I am signed up as "email@example.com"
33
32
  When I go to the sign in page
34
33
  And I sign in as "Email@example.com"
35
- Then I should see "Signed in"
36
- And I should be signed in
34
+ Then I should be signed in
@@ -9,5 +9,4 @@ Feature: Sign out
9
9
  When I sign in as "email@example.com"
10
10
  Then I should be signed in
11
11
  And I sign out
12
- Then I should see "Signed out"
13
- And I should be signed out
12
+ Then I should be signed out
@@ -24,5 +24,4 @@ Feature: Sign up
24
24
  When I fill in "Email" with "email@example.com"
25
25
  And I fill in "Password" with "password"
26
26
  And I press "Sign up"
27
- Then I should see "signed up"
28
- And I should be on the home page
27
+ Then I should be on the home page
@@ -2,17 +2,17 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "3.0.9"
6
5
  gem "sqlite3"
7
- gem "diesel", :git=>"git://github.com/thoughtbot/diesel.git"
8
- gem "cucumber-rails", "1.0.0"
9
- gem "capybara", "1.0.0"
10
- gem "factory_girl_rails"
6
+ gem "rails", "3.0.9"
11
7
  gem "shoulda-matchers", :git=>"git://github.com/thoughtbot/shoulda-matchers.git"
8
+ gem "diesel", :git=>"git://github.com/thoughtbot/diesel.git"
12
9
  gem "database_cleaner"
13
10
  gem "rspec-rails", "~> 2.6.0"
14
- gem "launchy"
11
+ gem "aruba", "~> 0.4.2"
12
+ gem "cucumber-rails", "1.0.0"
15
13
  gem "mocha"
16
14
  gem "appraisal", :git=>"git://github.com/thoughtbot/appraisal.git"
17
- gem "aruba", "~> 0.4.2"
15
+ gem "capybara", "1.0.0"
16
+ gem "factory_girl_rails"
17
+ gem "launchy"
18
18
 
@@ -2,21 +2,22 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "3.1.0.rc4"
5
+ gem "jquery-rails"
6
+ gem "uglifier"
6
7
  gem "sqlite3"
7
- gem "diesel", :git=>"git://github.com/thoughtbot/diesel.git"
8
- gem "cucumber-rails", "1.0.0"
9
- gem "capybara", "1.0.0"
10
- gem "factory_girl_rails"
8
+ gem "rails", "3.1.0.rc4"
9
+ gem "sass-rails"
11
10
  gem "shoulda-matchers", :git=>"git://github.com/thoughtbot/shoulda-matchers.git"
11
+ gem "coffee-script"
12
+ gem "diesel", :git=>"git://github.com/thoughtbot/diesel.git"
12
13
  gem "database_cleaner"
13
14
  gem "rspec-rails", "~> 2.6.0"
14
- gem "launchy"
15
+ gem "aruba", "~> 0.4.2"
16
+ gem "cucumber-rails", "1.0.0"
15
17
  gem "mocha"
18
+ gem "turn"
16
19
  gem "appraisal", :git=>"git://github.com/thoughtbot/appraisal.git"
17
- gem "aruba", "~> 0.4.2"
18
- gem "sass-rails"
19
- gem "coffee-script"
20
- gem "uglifier"
21
- gem "jquery-rails"
20
+ gem "capybara", "1.0.0"
21
+ gem "factory_girl_rails"
22
+ gem "launchy"
22
23
 
@@ -53,6 +53,7 @@ GEM
53
53
  activesupport (= 3.1.0.rc4)
54
54
  activesupport (3.1.0.rc4)
55
55
  multi_json (~> 1.0)
56
+ ansi (1.2.5)
56
57
  arel (2.1.1)
57
58
  aruba (0.4.3)
58
59
  bcat (>= 0.6.1)
@@ -182,6 +183,8 @@ GEM
182
183
  tilt (1.3.2)
183
184
  treetop (1.4.9)
184
185
  polyglot (>= 0.3.1)
186
+ turn (0.8.2)
187
+ ansi (>= 1.2.2)
185
188
  tzinfo (0.3.28)
186
189
  uglifier (0.5.4)
187
190
  execjs (>= 0.3.0)
@@ -209,4 +212,5 @@ DEPENDENCIES
209
212
  sass-rails
210
213
  shoulda-matchers!
211
214
  sqlite3
215
+ turn
212
216
  uglifier
@@ -7,7 +7,7 @@ module Clearance
7
7
  hide_action :current_user, :current_user=,
8
8
  :signed_in?, :signed_out?,
9
9
  :sign_in, :sign_out,
10
- :authorize, :deny_access
10
+ :authorize, :deny_access
11
11
  end
12
12
 
13
13
  # User in the current cookie
@@ -90,8 +90,12 @@ module Clearance
90
90
  # @param [String] optional flash message to display to denied user
91
91
  def deny_access(flash_message = nil)
92
92
  store_location
93
- flash[:failure] = flash_message if flash_message
94
- redirect_to(sign_in_url)
93
+ flash[:notice] = flash_message if flash_message
94
+ if signed_in?
95
+ redirect_to(url_after_denied_access_when_signed_in)
96
+ else
97
+ redirect_to(url_after_denied_access_when_signed_out)
98
+ end
95
99
  end
96
100
 
97
101
  # CSRF protection in Rails >= 3.0.4
@@ -131,5 +135,13 @@ module Clearance
131
135
  def redirect_to_root
132
136
  redirect_to('/')
133
137
  end
138
+
139
+ def url_after_denied_access_when_signed_in
140
+ '/'
141
+ end
142
+
143
+ def url_after_denied_access_when_signed_out
144
+ sign_in_url
145
+ end
134
146
  end
135
147
  end
@@ -0,0 +1,17 @@
1
+ require 'clearance/testing/assertion_error'
2
+ require 'clearance/testing/deny_access_matcher'
3
+ require 'clearance/testing/helpers'
4
+
5
+ if defined?(Test::Unit::TestCase)
6
+ Test::Unit::TestCase.extend Clearance::Testing::Matchers
7
+ class Test::Unit::TestCase
8
+ include Clearance::Testing::Helpers
9
+ end
10
+ end
11
+
12
+ if defined?(RSpec) && RSpec.respond_to?(:configure)
13
+ RSpec.configure do |config|
14
+ config.include Clearance::Testing::Matchers
15
+ config.include Clearance::Testing::Helpers
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ module Clearance
2
+ module Testing
3
+ if RUBY_VERSION > "1.9"
4
+ require 'minitest/unit'
5
+ AssertionError = MiniTest::Assertion
6
+ else
7
+ require 'test/unit/assertionfailederror'
8
+ AssertionError = Test::Unit::AssertionFailedError
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,73 @@
1
+ module Clearance
2
+ module Testing
3
+ module Matchers
4
+ # Ensures a controller denied access.
5
+ #
6
+ # @example
7
+ # it { should deny_access }
8
+ # it { should deny_access(:flash => "Denied access.") }
9
+ # it { should deny_access(:redirect => sign_in_url) }
10
+ def deny_access(opts = {})
11
+ DenyAccessMatcher.new(self, opts)
12
+ end
13
+
14
+ class DenyAccessMatcher
15
+ attr_reader :failure_message, :negative_failure_message
16
+
17
+ def initialize(context, opts)
18
+ @context = context
19
+ @flash = opts[:flash]
20
+ @url = opts[:redirect]
21
+
22
+ @failure_message = ""
23
+ @negative_failure_message = ""
24
+ end
25
+
26
+ def matches?(controller)
27
+ @controller = controller
28
+ sets_the_flash? && redirects_to_url?
29
+ end
30
+
31
+ def description
32
+ "deny access"
33
+ end
34
+
35
+ private
36
+
37
+ def sets_the_flash?
38
+ if @flash.blank?
39
+ true
40
+ else
41
+ if @controller.flash[:notice].try(:values).try(:first) == @flash
42
+ @negative_failure_message << "Didn't expect to set the flash to #{@flash}"
43
+ true
44
+ else
45
+ @failure_message << "Expected the flash to be set to #{@flash} but was #{@controller.flash[:notice].try(:values).try(:first)}"
46
+ false
47
+ end
48
+ end
49
+ end
50
+
51
+ def redirects_to_url?
52
+ @url ||= denied_access_url
53
+ begin
54
+ @context.send(:assert_redirected_to, @url)
55
+ @negative_failure_message << "Didn't expect to redirect to #{@url}."
56
+ true
57
+ rescue Clearance::Testing::AssertionError
58
+ @failure_message << "Expected to redirect to #{@url} but did not."
59
+ false
60
+ end
61
+ end
62
+
63
+ def denied_access_url
64
+ if @controller.signed_in?
65
+ '/'
66
+ else
67
+ @controller.sign_in_url
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,18 @@
1
+ module Clearance
2
+ module Testing
3
+ module Helpers
4
+ def sign_in_as(user)
5
+ @controller.current_user = user
6
+ return user
7
+ end
8
+
9
+ def sign_in
10
+ sign_in_as Factory(:user)
11
+ end
12
+
13
+ def sign_out
14
+ @controller.current_user = nil
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ class DeniesController < ActionController::Base
4
+ include Clearance::Authentication
5
+ before_filter :authorize, :only => :show
6
+
7
+ def new
8
+ render :text => "New page"
9
+ end
10
+
11
+ def show
12
+ render :text => "Show page"
13
+ end
14
+
15
+ protected
16
+
17
+ def authorize
18
+ deny_access(:flash => "Access denied.")
19
+ end
20
+ end
21
+
22
+ describe DeniesController do
23
+ before do
24
+ Rails.application.routes.draw do
25
+ resource :deny, :only => [:new, :show]
26
+ match 'sign_in' => 'clearance/sessions#new', :as => 'sign_in'
27
+ end
28
+ end
29
+
30
+ after do
31
+ Rails.application.reload_routes!
32
+ end
33
+
34
+ context "signed in user" do
35
+ before { sign_in }
36
+
37
+ it "allows access to new" do
38
+ get :new
39
+ subject.should_not deny_access
40
+ end
41
+
42
+ it "denies access to show" do
43
+ get :show
44
+ subject.should deny_access(:redirect => '/')
45
+ end
46
+ end
47
+
48
+ context "visitor" do
49
+ it "allows access to new" do
50
+ get :new
51
+ subject.should_not deny_access
52
+ end
53
+
54
+ it "denies access to show" do
55
+ get :show
56
+ subject.should deny_access
57
+ subject.should deny_access(:redirect => sign_in_url, :flash => "Access denied.")
58
+ end
59
+ end
60
+ end
@@ -36,14 +36,14 @@ describe ForgeriesController do
36
36
  subject.should redirect_to(:action => 'index')
37
37
  end
38
38
 
39
- it "redirects to sign_in with invalid token" do
39
+ it "fails with invalid token" do
40
40
  post :create, :authenticity_token => "hax0r"
41
- subject.should redirect_to(sign_in_url)
41
+ subject.should deny_access
42
42
  end
43
43
 
44
- it "redirects to sign_in with no token" do
44
+ it "fails with no token" do
45
45
  post :create
46
- subject.should redirect_to(sign_in_url)
46
+ subject.should deny_access
47
47
  end
48
48
  end
49
49
  end
@@ -31,8 +31,7 @@ describe Clearance::PasswordsController do
31
31
 
32
32
  it { should have_sent_email.with_subject(/change your password/i) }
33
33
 
34
- it { should set_the_flash.to(/password/i) }
35
- it { should redirect_to_url_after_create }
34
+ it { should respond_with(:success) }
36
35
  end
37
36
 
38
37
  describe "with incorrect email address" do
@@ -53,10 +52,7 @@ describe Clearance::PasswordsController do
53
52
  ActionMailer::Base.deliveries.should be_empty
54
53
  end
55
54
 
56
- it "should set the failure flash to Unknown email" do
57
- flash.now[:failure].should =~ /unknown email/i
58
- end
59
-
55
+ it { should set_the_flash.to(/unknown email/i).now }
60
56
  it { should render_template(:new) }
61
57
  end
62
58
  end
@@ -127,7 +123,6 @@ describe Clearance::PasswordsController do
127
123
  @user.remember_token.should_not be_nil
128
124
  end
129
125
 
130
- it { should set_the_flash.to(/signed in/i) }
131
126
  it { should redirect_to_url_after_update }
132
127
  end
133
128
 
@@ -18,7 +18,6 @@ describe Clearance::SessionsController do
18
18
  :password => @user.password }
19
19
  end
20
20
 
21
- it { should set_the_flash.to(/signed in/i) }
22
21
  it { should redirect_to_url_after_create }
23
22
 
24
23
  it "sets a remember token cookie" do
@@ -129,7 +128,6 @@ describe Clearance::SessionsController do
129
128
  sign_out
130
129
  delete :destroy
131
130
  end
132
- it { should set_the_flash.to(/signed out/i) }
133
131
  it { should redirect_to_url_after_destroy }
134
132
  end
135
133
 
@@ -141,7 +139,6 @@ describe Clearance::SessionsController do
141
139
  delete :destroy
142
140
  end
143
141
 
144
- it { should set_the_flash.to(/signed out/i) }
145
142
  it { should redirect_to_url_after_destroy }
146
143
 
147
144
  it "should delete the cookie token" do
@@ -36,9 +36,26 @@ describe Clearance::UsersController do
36
36
  User.count.should == @old_user_count + 1
37
37
  end
38
38
 
39
- it { should set_the_flash.to(/signed up/i) }
40
39
  it { should redirect_to_url_after_create }
41
40
  end
41
+
42
+ describe "on POST to #create with valid attributes and a session return url" do
43
+ before do
44
+ user_attributes = Factory.attributes_for(:user)
45
+ @old_user_count = User.count
46
+ @return_url = '/url_in_the_session'
47
+ @request.session[:return_to] = @return_url
48
+ post :create, :user => user_attributes
49
+ end
50
+
51
+ it { should assign_to(:user) }
52
+
53
+ it "should create a new user" do
54
+ User.count.should == @old_user_count + 1
55
+ end
56
+
57
+ it { should redirect_to(@return_url) }
58
+ end
42
59
  end
43
60
 
44
61
  describe "A signed-in user" do
data/spec/spec_helper.rb CHANGED
@@ -11,7 +11,7 @@ Bundler.require
11
11
  require 'diesel/testing'
12
12
  require 'rspec/rails'
13
13
 
14
- require 'clearance/test_matchers'
14
+ require 'clearance/testing'
15
15
 
16
16
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
17
17
 
@@ -10,3 +10,29 @@ end
10
10
  class User < ActiveRecord::Base
11
11
  include Clearance::User
12
12
  end
13
+
14
+ module Clearance
15
+ module Test
16
+ module Redirects
17
+ def redirect_to_url_after_create
18
+ redirect_to(@controller.send(:url_after_create))
19
+ end
20
+
21
+ def redirect_to_url_after_update
22
+ redirect_to(@controller.send(:url_after_update))
23
+ end
24
+
25
+ def redirect_to_url_after_destroy
26
+ redirect_to(@controller.send(:url_after_destroy))
27
+ end
28
+
29
+ def redirect_to_url_already_confirmed
30
+ redirect_to(@controller.send(:url_already_confirmed))
31
+ end
32
+ end
33
+ end
34
+ end
35
+
36
+ RSpec.configure do |config|
37
+ config.include Clearance::Test::Redirects
38
+ end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearance
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 47
4
5
  prerelease:
5
- version: 0.11.2
6
+ segments:
7
+ - 0
8
+ - 12
9
+ - 0
10
+ version: 0.12.0
6
11
  platform: ruby
7
12
  authors:
8
13
  - Dan Croak
@@ -19,7 +24,8 @@ autorequire:
19
24
  bindir: bin
20
25
  cert_chain: []
21
26
 
22
- date: 2011-06-29 00:00:00 Z
27
+ date: 2011-06-30 00:00:00 -04:00
28
+ default_executable:
23
29
  dependencies:
24
30
  - !ruby/object:Gem::Dependency
25
31
  name: rails
@@ -29,6 +35,10 @@ dependencies:
29
35
  requirements:
30
36
  - - ">="
31
37
  - !ruby/object:Gem::Version
38
+ hash: 7
39
+ segments:
40
+ - 3
41
+ - 0
32
42
  version: "3.0"
33
43
  type: :runtime
34
44
  version_requirements: *id001
@@ -40,6 +50,11 @@ dependencies:
40
50
  requirements:
41
51
  - - ~>
42
52
  - !ruby/object:Gem::Version
53
+ hash: 19
54
+ segments:
55
+ - 0
56
+ - 1
57
+ - 4
43
58
  version: 0.1.4
44
59
  type: :runtime
45
60
  version_requirements: *id002
@@ -51,6 +66,11 @@ dependencies:
51
66
  requirements:
52
67
  - - ~>
53
68
  - !ruby/object:Gem::Version
69
+ hash: 23
70
+ segments:
71
+ - 1
72
+ - 0
73
+ - 0
54
74
  version: 1.0.0
55
75
  type: :development
56
76
  version_requirements: *id003
@@ -80,6 +100,7 @@ files:
80
100
  - app/mailers/clearance_mailer.rb
81
101
  - app/views/clearance_mailer/change_password.html.erb
82
102
  - app/views/layouts/application.html.erb
103
+ - app/views/passwords/create.html.erb
83
104
  - app/views/passwords/edit.html.erb
84
105
  - app/views/passwords/new.html.erb
85
106
  - app/views/sessions/new.html.erb
@@ -113,7 +134,10 @@ files:
113
134
  - lib/clearance/authentication.rb
114
135
  - lib/clearance/configuration.rb
115
136
  - lib/clearance/engine.rb
116
- - lib/clearance/test_matchers.rb
137
+ - lib/clearance/testing.rb
138
+ - lib/clearance/testing/assertion_error.rb
139
+ - lib/clearance/testing/deny_access_matcher.rb
140
+ - lib/clearance/testing/helpers.rb
117
141
  - lib/clearance/user.rb
118
142
  - lib/generators/clearance/features/features_generator.rb
119
143
  - lib/generators/clearance/install/install_generator.rb
@@ -122,6 +146,7 @@ files:
122
146
  - lib/generators/clearance/install/templates/db/migrate/upgrade_clearance_to_diesel.rb
123
147
  - lib/generators/clearance/install/templates/user.rb
124
148
  - lib/generators/clearance/views/views_generator.rb
149
+ - spec/controllers/denies_controller_spec.rb
125
150
  - spec/controllers/forgeries_controller_spec.rb
126
151
  - spec/controllers/passwords_controller_spec.rb
127
152
  - spec/controllers/sessions_controller_spec.rb
@@ -132,6 +157,7 @@ files:
132
157
  - spec/spec_helper.rb
133
158
  - spec/support/clearance.rb
134
159
  - spec/support/cookies.rb
160
+ has_rdoc: true
135
161
  homepage: http://github.com/thoughtbot/clearance
136
162
  licenses: []
137
163
 
@@ -145,17 +171,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
171
  requirements:
146
172
  - - ">="
147
173
  - !ruby/object:Gem::Version
174
+ hash: 3
175
+ segments:
176
+ - 0
148
177
  version: "0"
149
178
  required_rubygems_version: !ruby/object:Gem::Requirement
150
179
  none: false
151
180
  requirements:
152
181
  - - ">="
153
182
  - !ruby/object:Gem::Version
183
+ hash: 3
184
+ segments:
185
+ - 0
154
186
  version: "0"
155
187
  requirements: []
156
188
 
157
189
  rubyforge_project:
158
- rubygems_version: 1.7.2
190
+ rubygems_version: 1.6.2
159
191
  signing_key:
160
192
  specification_version: 3
161
193
  summary: Rails authentication & authorization with email & password.
@@ -1,60 +0,0 @@
1
- module Clearance
2
- module Test
3
- module Matchers
4
- def deny_access(opts = {})
5
- if opts[:flash]
6
- should set_the_flash.to(opts[:flash])
7
- else
8
- should_not set_the_flash
9
- end
10
-
11
- redirect_to(sign_in_url)
12
- end
13
-
14
- def redirect_to_url_after_create
15
- redirect_to(@controller.send(:url_after_create))
16
- end
17
-
18
- def redirect_to_url_after_update
19
- redirect_to(@controller.send(:url_after_update))
20
- end
21
-
22
- def redirect_to_url_after_destroy
23
- redirect_to(@controller.send(:url_after_destroy))
24
- end
25
-
26
- def redirect_to_url_already_confirmed
27
- redirect_to(@controller.send(:url_already_confirmed))
28
- end
29
- end
30
-
31
- module Helpers
32
- def sign_in_as(user)
33
- @controller.current_user = user
34
- return user
35
- end
36
-
37
- def sign_in
38
- sign_in_as Factory(:user)
39
- end
40
-
41
- def sign_out
42
- @controller.current_user = nil
43
- end
44
- end
45
- end
46
- end
47
-
48
- if defined?(Test::Unit::TestCase)
49
- Test::Unit::TestCase.extend Clearance::Test::Matchers
50
- class Test::Unit::TestCase
51
- include Clearance::Test::Helpers
52
- end
53
- end
54
-
55
- if defined?(RSpec) && RSpec.respond_to?(:configure)
56
- RSpec.configure do |config|
57
- config.include Clearance::Test::Matchers
58
- config.include Clearance::Test::Helpers
59
- end
60
- end