clearance 1.6.1 → 1.7.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d1008b7898db9ab0ed2eb372b1c9ec92c54c98a
4
- data.tar.gz: 86b11a51fa7ba23911a500547d8ad065c7d9590a
3
+ metadata.gz: 4a379553672fd5a49ba2e23f23f3179d0e023b8b
4
+ data.tar.gz: 51022e7a675360f0c142a9812d753fa2a6cf240b
5
5
  SHA512:
6
- metadata.gz: c62112e27660a5258ad4a2078c5fe993bbf3171e048437ef56572706443b7f24c5ac14ca39cfa80855fd80ea204b8a973630d2fda1ef4b923160223f60f4ef51
7
- data.tar.gz: c5a9870f0523c669d49e350cc980a6e29b0a9b9b9a3e2cd08f4439f7607478743068f875b55d348e32ebd8dca478ebce3003b4d4cc502c16d5705cb39147c5cf
6
+ metadata.gz: 562072cad198bc2e707fbf163ffc279e7b5f6abdc70fc98b777df0f669b33026e6924954429fdabf888512f58535ebe3a80999edb9f79cf92ea711cbde96a0cf
7
+ data.tar.gz: a19e25467230e87006d4dd1d08932333df4ef47814d60a51766f0648475e8ca67d4a15b86c87b7baaddb739897aa9f5468be7df77bfcaa53c1e87faf99548117
data/.travis.yml CHANGED
@@ -7,6 +7,7 @@ rvm:
7
7
  - 1.9.3
8
8
  - 2.0.0
9
9
  - 2.1.5
10
+ - 2.2.0
10
11
 
11
12
  install:
12
13
  - "travis_retry bin/setup"
data/Appraisals CHANGED
@@ -1,13 +1,16 @@
1
- appraise 'rails3.2' do
2
- gem 'rails', '~> 3.2.21'
1
+ if RUBY_VERSION < "2.2.0"
2
+ appraise 'rails3.2' do
3
+ gem 'rails', '~> 3.2.21'
4
+ end
3
5
  end
4
6
 
5
7
  appraise 'rails4.0' do
6
- gem 'rails', '~> 4.0.12'
8
+ gem 'rails', '~> 4.0.13'
9
+ gem 'test-unit'
7
10
  end
8
11
 
9
12
  appraise 'rails4.1' do
10
- gem 'rails', '~> 4.1.8'
13
+ gem 'rails', '~> 4.1.9'
11
14
  end
12
15
 
13
16
  appraise 'rails4.2' do
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clearance (1.6.1)
4
+ clearance (1.7.0)
5
5
  bcrypt
6
6
  email_validator (~> 1.4)
7
7
  rails (>= 3.1)
@@ -68,7 +68,7 @@ GEM
68
68
  childprocess (0.5.5)
69
69
  ffi (~> 1.0, >= 1.0.11)
70
70
  coderay (1.1.0)
71
- cucumber (1.3.17)
71
+ cucumber (1.3.18)
72
72
  builder (>= 2.1.2)
73
73
  diff-lcs (>= 1.1.3)
74
74
  gherkin (~> 2.12)
@@ -104,7 +104,7 @@ GEM
104
104
  mime-types (>= 1.16, < 3)
105
105
  method_source (0.8.2)
106
106
  mime-types (2.4.3)
107
- mini_portile (0.6.1)
107
+ mini_portile (0.6.2)
108
108
  minitest (5.5.0)
109
109
  multi_json (1.10.1)
110
110
  multi_test (0.1.1)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2009-2014 thoughtbot, inc.
3
+ Copyright (c) 2009 thoughtbot, inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/NEWS.md CHANGED
@@ -1,5 +1,12 @@
1
1
  Thank you to all the [contributors](https://github.com/thoughtbot/clearance/graphs/contributors)!
2
2
 
3
+ New for 1.7.0 (January, 8, 2015)
4
+ * The `authorize` filter has been deprecated in favor of `require_login`. Update
5
+ all reference to the filter including any calls to `skip_before_filter` or
6
+ `skip_before_action`.
7
+ * The `Clearance.root` method has been deprecated.
8
+ * Fix the negation of the `deny_access` matcher in Rails 4.0.x on Ruby 2.2
9
+
3
10
  New for 1.6.1 (January 6, 2015)
4
11
  * Secure cookies are no longer overwritten when the user visits a non-HTTPS URL.
5
12
 
data/README.md CHANGED
@@ -100,11 +100,11 @@ Clearance.configure do |config|
100
100
  end
101
101
  ```
102
102
 
103
- Use `authorize` to control access in controllers:
103
+ Use `require_login` to control access in controllers:
104
104
 
105
105
  ```ruby
106
106
  class ArticlesController < ApplicationController
107
- before_filter :authorize
107
+ before_filter :require_login
108
108
 
109
109
  def index
110
110
  current_user.articles
@@ -460,10 +460,10 @@ Run the specs:
460
460
 
461
461
  rake
462
462
 
463
- Testing authorized controller actions
464
- -------------------------------------
463
+ Testing controller actions that require login
464
+ ---------------------------------------------
465
465
 
466
- To test controller actions that are protected by `before_filter :authorize`,
466
+ To test controller actions that are protected by `before_filter :require_login`,
467
467
  require Clearance's test helpers and matchers in your test suite.
468
468
 
469
469
  For `rspec`, add this line to your `spec/spec_helper.rb`:
@@ -555,7 +555,7 @@ you. Thank you!
555
555
  License
556
556
  -------
557
557
 
558
- Clearance is copyright © 2009-2014 thoughtbot. It is free software, and may be
558
+ Clearance is copyright © 2009 thoughtbot. It is free software, and may be
559
559
  redistributed under the terms specified in the `LICENSE` file.
560
560
 
561
561
  The names and logos for thoughtbot are trademarks of thoughtbot, inc.
@@ -1,7 +1,7 @@
1
1
  require 'active_support/deprecation'
2
2
 
3
3
  class Clearance::PasswordsController < Clearance::BaseController
4
- skip_before_filter :authorize, only: [:create, :edit, :new, :update]
4
+ skip_before_filter :require_login, only: [:create, :edit, :new, :update]
5
5
  before_filter :forbid_missing_token, only: [:edit, :update]
6
6
  before_filter :forbid_non_existent_user, only: [:edit, :update]
7
7
 
@@ -1,5 +1,5 @@
1
1
  class Clearance::SessionsController < Clearance::BaseController
2
- skip_before_filter :authorize, only: [:create, :new, :destroy]
2
+ skip_before_filter :require_login, only: [:create, :new, :destroy]
3
3
  protect_from_forgery except: :create
4
4
 
5
5
  def create
@@ -1,5 +1,5 @@
1
1
  class Clearance::UsersController < Clearance::BaseController
2
- skip_before_filter :authorize, only: [:create, :new]
2
+ skip_before_filter :require_login, only: [:create, :new]
3
3
  before_filter :avoid_sign_in, only: [:create, :new], if: :signed_in?
4
4
 
5
5
  def new
@@ -7,6 +7,7 @@ Feature: generate rspec integration tests with application
7
7
  | rspec-rails |
8
8
  | factory_girl_rails |
9
9
  | database_cleaner |
10
+ | test-unit |
10
11
 
11
12
  Scenario: generate a Rails app, run the generators, and run the tests
12
13
  When I install dependencies
@@ -15,6 +15,7 @@ gem "shoulda-matchers", "~> 2.4"
15
15
  gem "sqlite3", "~> 1.3"
16
16
  gem "timecop", "~> 0.6"
17
17
  gem "pry", :require => false
18
- gem "rails", "~> 4.0.12"
18
+ gem "rails", "~> 4.0.13"
19
+ gem "test-unit"
19
20
 
20
21
  gemspec :path => "../"
@@ -15,6 +15,6 @@ gem "shoulda-matchers", "~> 2.4"
15
15
  gem "sqlite3", "~> 1.3"
16
16
  gem "timecop", "~> 0.6"
17
17
  gem "pry", :require => false
18
- gem "rails", "~> 4.1.8"
18
+ gem "rails", "~> 4.1.9"
19
19
 
20
20
  gemspec :path => "../"
data/lib/clearance.rb CHANGED
@@ -11,6 +11,9 @@ require 'clearance/constraints'
11
11
 
12
12
  module Clearance
13
13
  def self.root
14
+ warn "#{Kernel.caller.first}: [DEPRECATION] `Clearance.root` is " +
15
+ "deprecated and will be removed in the next major release. If you need " +
16
+ "to find Clearance's root, you can use the `Gem::Specification` API."
14
17
  File.expand_path('../..', __FILE__)
15
18
  end
16
19
  end
@@ -3,15 +3,23 @@ module Clearance
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- hide_action :authorize, :deny_access
6
+ hide_action :authorize, :deny_access, :require_login
7
7
  end
8
8
 
9
- def authorize
9
+ def require_login
10
10
  unless signed_in?
11
11
  deny_access
12
12
  end
13
13
  end
14
14
 
15
+ def authorize
16
+ warn "[DEPRECATION] Clearance's `authorize` before_filter is " +
17
+ "deprecated. Use `require_login` instead. Be sure to update any " +
18
+ "instances of `skip_before_filter :authorize` or " +
19
+ "`skip_before_action :authorize` as well"
20
+ require_login
21
+ end
22
+
15
23
  def deny_access(flash_message = nil)
16
24
  respond_to do |format|
17
25
  format.any(:js, :json, :xml) { head :unauthorized }
@@ -64,7 +64,7 @@ module Clearance
64
64
  @failure_message_when_negated <<
65
65
  "Didn't expect to redirect to #{@url}."
66
66
  true
67
- rescue MiniTest::Assertion
67
+ rescue MiniTest::Assertion, ::Test::Unit::AssertionFailedError
68
68
  @failure_message << "Expected to redirect to #{@url} but did not."
69
69
  false
70
70
  end
@@ -1,3 +1,3 @@
1
1
  module Clearance
2
- VERSION = "1.6.1"
2
+ VERSION = "1.7.0"
3
3
  end
@@ -3,7 +3,7 @@ require 'rails/generators/base'
3
3
  module Clearance
4
4
  module Generators
5
5
  class ViewsGenerator < Rails::Generators::Base
6
- source_root Clearance.root
6
+ source_root File.expand_path("../../../../..", __FILE__)
7
7
 
8
8
  def create_views
9
9
  views.each do |view|
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  class ApisController < ActionController::Base
4
4
  include Clearance::Controller
5
5
 
6
- before_filter :authorize
6
+ before_filter :require_login
7
7
 
8
8
  def show
9
9
  render text: 'response'
@@ -4,7 +4,7 @@ class ForgeriesController < ActionController::Base
4
4
  include Clearance::Controller
5
5
 
6
6
  protect_from_forgery
7
- before_filter :authorize
7
+ before_filter :require_login
8
8
 
9
9
  # This is off in test by default, but we need it for this test
10
10
  self.allow_forgery_protection = true
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  class PermissionsController < ActionController::Base
4
4
  include Clearance::Controller
5
5
 
6
- before_filter :authorize, only: :show
6
+ before_filter :require_login, only: :show
7
7
 
8
8
  def new
9
9
  render text: 'New page'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Croak
@@ -25,7 +25,7 @@ authors:
25
25
  autorequire:
26
26
  bindir: bin
27
27
  cert_chain: []
28
- date: 2015-01-07 00:00:00.000000000 Z
28
+ date: 2015-01-08 00:00:00.000000000 Z
29
29
  dependencies:
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: bcrypt