authpwn_rails 0.6.0 → 0.7.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.6.0
1
+ 0.7.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{authpwn_rails}
8
- s.version = "0.6.0"
8
+ s.version = "0.7.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"]
12
- s.date = %q{2010-11-25}
12
+ s.date = %q{2011-03-04}
13
13
  s.description = %q{Works with Facebook.}
14
14
  s.email = %q{victor@costan.us}
15
15
  s.extra_rdoc_files = [
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
59
59
  ]
60
60
  s.homepage = %q{http://github.com/pwnall/authpwn_rails}
61
61
  s.require_paths = ["lib"]
62
- s.rubygems_version = %q{1.3.7}
62
+ s.rubygems_version = %q{1.5.3}
63
63
  s.summary = %q{User authentication for Rails 3 applications.}
64
64
  s.test_files = [
65
65
  "test/cookie_controller_test.rb",
@@ -76,7 +76,6 @@ Gem::Specification.new do |s|
76
76
  ]
77
77
 
78
78
  if s.respond_to? :specification_version then
79
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
80
79
  s.specification_version = 3
81
80
 
82
81
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -13,10 +13,24 @@ class SessionControllerTest < ActionController::TestCase
13
13
  assert_select 'a', 'Log out'
14
14
  end
15
15
 
16
+ test "user logged in JSON request" do
17
+ set_session_current_user @user
18
+ get :show, :format => 'json'
19
+
20
+ assert_equal @user.email,
21
+ ActiveSupport::JSON.decode(response.body)['user']['email']
22
+ end
23
+
16
24
  test "application welcome page" do
17
25
  get :show
18
26
 
19
27
  assert_equal User.count, assigns(:user_count)
20
28
  assert_select 'a', 'Log in'
21
29
  end
30
+
31
+ test "user not logged in with JSON request" do
32
+ get :show, :format => 'json'
33
+
34
+ assert_equal({}, ActiveSupport::JSON.decode(response.body))
35
+ end
22
36
  end
@@ -88,10 +88,20 @@ module SessionControllerInstanceMethods
88
88
  @user = current_user || User.new
89
89
  if @user.new_record?
90
90
  welcome
91
- render :action => :welcome unless performed?
91
+ unless performed?
92
+ respond_to do |format|
93
+ format.html { render :action => :welcome }
94
+ format.json { render :json => {} }
95
+ end
96
+ end
92
97
  else
93
98
  home
94
- render :action => :home unless performed?
99
+ unless performed?
100
+ respond_to do |format|
101
+ format.html { render :action => :home }
102
+ format.json { render :json => @user }
103
+ end
104
+ end
95
105
  end
96
106
  end
97
107
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authpwn_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 6
8
+ - 7
9
9
  - 0
10
- version: 0.6.0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Victor Costan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-25 00:00:00 -05:00
18
+ date: 2011-03-04 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements: []
146
146
 
147
147
  rubyforge_project:
148
- rubygems_version: 1.3.7
148
+ rubygems_version: 1.5.3
149
149
  signing_key:
150
150
  specification_version: 3
151
151
  summary: User authentication for Rails 3 applications.