authpwn_rails 0.10.12 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.12
1
+ 0.11.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "authpwn_rails"
8
- s.version = "0.10.12"
8
+ s.version = "0.11.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Victor Costan"]
@@ -58,7 +58,12 @@ module ControllerTestExtensions
58
58
  # Tests that need to disable transactional fixures should specify the user's
59
59
  # password.
60
60
  def set_http_basic_user(user, password = nil)
61
- unless password
61
+ if user.nil?
62
+ request.env.delete 'HTTP_AUTHORIZATION'
63
+ return self
64
+ end
65
+
66
+ if password.nil?
62
67
  password = 'password'
63
68
  credential = Credentials::Password.where(:user_id => user.id).first
64
69
  if credential
@@ -78,7 +83,7 @@ module ControllerTestExtensions
78
83
 
79
84
  request.env['HTTP_AUTHORIZATION'] =
80
85
  "Basic #{::Base64.strict_encode64("#{email}:#{password}")}"
81
- user
86
+ self
82
87
  end
83
88
  end # module Authpwn::ControllerTestExtensions
84
89
 
@@ -52,6 +52,14 @@ class HttpBasicControllerTest < ActionController::TestCase
52
52
  assert_equal 'No user', response.body
53
53
  end
54
54
 
55
+ test "reset user credentials in header" do
56
+ set_http_basic_user @user, 'pa55w0rd'
57
+ set_http_basic_user nil
58
+ get :show
59
+ assert_nil assigns(:current_user)
60
+ assert_equal 'No user', response.body
61
+ end
62
+
55
63
  test "mocked user credentials in header" do
56
64
  set_http_basic_user @user
57
65
  get :show
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authpwn_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.12
4
+ version: 0.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -278,7 +278,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
278
  version: '0'
279
279
  segments:
280
280
  - 0
281
- hash: 546732945991405653
281
+ hash: 903064775847745508
282
282
  required_rubygems_version: !ruby/object:Gem::Requirement
283
283
  none: false
284
284
  requirements: