simple_auth 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +68 -84
- data/lib/simple_auth/rspec.rb +29 -0
- data/lib/simple_auth/version.rb +1 -1
- data/simple_auth.gemspec +1 -2
- data/spec/controllers/require_logged_user_spec.rb +2 -2
- metadata +17 -27
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source :rubygems
|
2
2
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,123 +1,108 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_auth (1.4.
|
4
|
+
simple_auth (1.4.2)
|
5
5
|
rails (>= 3.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
|
-
remote: http://
|
8
|
+
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionmailer (3.1
|
11
|
-
actionpack (= 3.1
|
12
|
-
mail (~> 2.
|
13
|
-
actionpack (3.1
|
14
|
-
activemodel (= 3.1
|
15
|
-
activesupport (= 3.1
|
10
|
+
actionmailer (3.2.1)
|
11
|
+
actionpack (= 3.2.1)
|
12
|
+
mail (~> 2.4.0)
|
13
|
+
actionpack (3.2.1)
|
14
|
+
activemodel (= 3.2.1)
|
15
|
+
activesupport (= 3.2.1)
|
16
16
|
builder (~> 3.0.0)
|
17
17
|
erubis (~> 2.7.0)
|
18
|
-
|
19
|
-
rack (~> 1.
|
20
|
-
rack-cache (~> 1.
|
21
|
-
rack-mount (~> 0.8.2)
|
18
|
+
journey (~> 1.0.1)
|
19
|
+
rack (~> 1.4.0)
|
20
|
+
rack-cache (~> 1.1)
|
22
21
|
rack-test (~> 0.6.1)
|
23
|
-
sprockets (~> 2.
|
24
|
-
activemodel (3.1
|
25
|
-
activesupport (= 3.1
|
26
|
-
bcrypt-ruby (~> 3.0.0)
|
22
|
+
sprockets (~> 2.1.2)
|
23
|
+
activemodel (3.2.1)
|
24
|
+
activesupport (= 3.2.1)
|
27
25
|
builder (~> 3.0.0)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
arel (~> 2.2.1)
|
26
|
+
activerecord (3.2.1)
|
27
|
+
activemodel (= 3.2.1)
|
28
|
+
activesupport (= 3.2.1)
|
29
|
+
arel (~> 3.0.0)
|
33
30
|
tzinfo (~> 0.3.29)
|
34
|
-
activeresource (3.1
|
35
|
-
activemodel (= 3.1
|
36
|
-
activesupport (= 3.1
|
37
|
-
activesupport (3.1
|
31
|
+
activeresource (3.2.1)
|
32
|
+
activemodel (= 3.2.1)
|
33
|
+
activesupport (= 3.2.1)
|
34
|
+
activesupport (3.2.1)
|
35
|
+
i18n (~> 0.6)
|
38
36
|
multi_json (~> 1.0)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
bson_ext (1.3.1)
|
37
|
+
arel (3.0.2)
|
38
|
+
bson (1.6.0)
|
39
|
+
bson_ext (1.6.0)
|
40
|
+
bson (= 1.6.0)
|
44
41
|
builder (3.0.0)
|
45
|
-
columnize (0.3.4)
|
46
42
|
diff-lcs (1.1.3)
|
47
43
|
erubis (2.7.0)
|
48
44
|
hike (1.2.1)
|
49
45
|
i18n (0.6.0)
|
50
|
-
|
51
|
-
|
52
|
-
mail (2.
|
46
|
+
journey (1.0.3)
|
47
|
+
json (1.6.5)
|
48
|
+
mail (2.4.1)
|
53
49
|
i18n (>= 0.4.0)
|
54
50
|
mime-types (~> 1.16)
|
55
51
|
treetop (~> 1.4.8)
|
56
|
-
mime-types (1.
|
57
|
-
mongo (1.
|
58
|
-
bson (
|
59
|
-
mongo_mapper (0.9.
|
52
|
+
mime-types (1.17.2)
|
53
|
+
mongo (1.6.0)
|
54
|
+
bson (= 1.6.0)
|
55
|
+
mongo_mapper (0.9.2)
|
60
56
|
activemodel (~> 3.0)
|
61
57
|
activesupport (~> 3.0)
|
62
58
|
plucky (~> 0.3.8)
|
63
|
-
multi_json (1.0
|
59
|
+
multi_json (1.1.0)
|
64
60
|
plucky (0.3.8)
|
65
61
|
mongo (~> 1.3)
|
66
|
-
polyglot (0.3.
|
67
|
-
rack (1.
|
68
|
-
rack-cache (1.
|
62
|
+
polyglot (0.3.3)
|
63
|
+
rack (1.4.1)
|
64
|
+
rack-cache (1.1)
|
69
65
|
rack (>= 0.4)
|
70
|
-
rack-mount (0.8.3)
|
71
|
-
rack (>= 1.0.0)
|
72
66
|
rack-ssl (1.3.2)
|
73
67
|
rack
|
74
68
|
rack-test (0.6.1)
|
75
69
|
rack (>= 1.0)
|
76
|
-
rails (3.1
|
77
|
-
actionmailer (= 3.1
|
78
|
-
actionpack (= 3.1
|
79
|
-
activerecord (= 3.1
|
80
|
-
activeresource (= 3.1
|
81
|
-
activesupport (= 3.1
|
70
|
+
rails (3.2.1)
|
71
|
+
actionmailer (= 3.2.1)
|
72
|
+
actionpack (= 3.2.1)
|
73
|
+
activerecord (= 3.2.1)
|
74
|
+
activeresource (= 3.2.1)
|
75
|
+
activesupport (= 3.2.1)
|
82
76
|
bundler (~> 1.0)
|
83
|
-
railties (= 3.1
|
84
|
-
railties (3.1
|
85
|
-
actionpack (= 3.1
|
86
|
-
activesupport (= 3.1
|
77
|
+
railties (= 3.2.1)
|
78
|
+
railties (3.2.1)
|
79
|
+
actionpack (= 3.2.1)
|
80
|
+
activesupport (= 3.2.1)
|
87
81
|
rack-ssl (~> 1.3.2)
|
88
82
|
rake (>= 0.8.7)
|
89
83
|
rdoc (~> 3.4)
|
90
84
|
thor (~> 0.14.6)
|
91
|
-
rake (0.9.2)
|
92
|
-
rdoc (3.
|
93
|
-
|
94
|
-
|
95
|
-
rspec-
|
96
|
-
rspec-
|
97
|
-
|
98
|
-
rspec-
|
85
|
+
rake (0.9.2.2)
|
86
|
+
rdoc (3.12)
|
87
|
+
json (~> 1.4)
|
88
|
+
rspec (2.8.0)
|
89
|
+
rspec-core (~> 2.8.0)
|
90
|
+
rspec-expectations (~> 2.8.0)
|
91
|
+
rspec-mocks (~> 2.8.0)
|
92
|
+
rspec-core (2.8.0)
|
93
|
+
rspec-expectations (2.8.0)
|
99
94
|
diff-lcs (~> 1.1.2)
|
100
|
-
rspec-mocks (2.
|
101
|
-
rspec-rails (2.
|
102
|
-
actionpack (
|
103
|
-
activesupport (
|
104
|
-
railties (
|
105
|
-
rspec (~> 2.
|
106
|
-
|
107
|
-
columnize (>= 0.3.1)
|
108
|
-
linecache19 (>= 0.5.11)
|
109
|
-
ruby_core_source (>= 0.1.4)
|
110
|
-
ruby-debug19 (0.11.6)
|
111
|
-
columnize (>= 0.3.1)
|
112
|
-
linecache19 (>= 0.5.11)
|
113
|
-
ruby-debug-base19 (>= 0.11.19)
|
114
|
-
ruby_core_source (0.1.5)
|
115
|
-
archive-tar-minitar (>= 0.5.2)
|
116
|
-
sprockets (2.0.0)
|
95
|
+
rspec-mocks (2.8.0)
|
96
|
+
rspec-rails (2.8.1)
|
97
|
+
actionpack (>= 3.0)
|
98
|
+
activesupport (>= 3.0)
|
99
|
+
railties (>= 3.0)
|
100
|
+
rspec (~> 2.8.0)
|
101
|
+
sprockets (2.1.2)
|
117
102
|
hike (~> 1.2)
|
118
103
|
rack (~> 1.0)
|
119
|
-
tilt (
|
120
|
-
sqlite3 (1.3.
|
104
|
+
tilt (~> 1.1, != 1.3.0)
|
105
|
+
sqlite3 (1.3.5)
|
121
106
|
sqlite3-ruby (1.3.3)
|
122
107
|
sqlite3 (>= 1.3.3)
|
123
108
|
thor (0.14.6)
|
@@ -125,7 +110,7 @@ GEM
|
|
125
110
|
treetop (1.4.10)
|
126
111
|
polyglot
|
127
112
|
polyglot (>= 0.3.1)
|
128
|
-
tzinfo (0.3.
|
113
|
+
tzinfo (0.3.31)
|
129
114
|
|
130
115
|
PLATFORMS
|
131
116
|
ruby
|
@@ -133,7 +118,6 @@ PLATFORMS
|
|
133
118
|
DEPENDENCIES
|
134
119
|
bson_ext
|
135
120
|
mongo_mapper (~> 0.9.1)
|
136
|
-
rspec-rails (~> 2.5
|
137
|
-
ruby-debug19
|
121
|
+
rspec-rails (~> 2.5)
|
138
122
|
simple_auth!
|
139
123
|
sqlite3-ruby
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module SimpleAuth
|
2
|
+
module RSpec
|
3
|
+
# A simple helper to stub current session options.
|
4
|
+
#
|
5
|
+
# simple_auth(:user => User.first) # the most common case
|
6
|
+
# simple_auth(:authorized => false)
|
7
|
+
# simple_auth(:session => mock("current_session", :valid? => false))
|
8
|
+
#
|
9
|
+
# This is how you set it up:
|
10
|
+
#
|
11
|
+
# # spec/spec_helper.rb
|
12
|
+
# require "simple_auth/rspec"
|
13
|
+
# RSpec.configure {|c| c.include SimpleAuth::RSpec, :type => :controller}
|
14
|
+
#
|
15
|
+
def simple_auth(options = {})
|
16
|
+
options.reverse_merge!({
|
17
|
+
:session => mock("current_session").as_null_object,
|
18
|
+
:authorized => true,
|
19
|
+
:user => mock("current_user").as_null_object
|
20
|
+
})
|
21
|
+
|
22
|
+
controller.stub({
|
23
|
+
:current_user => options[:user],
|
24
|
+
:authorized? => options[:authorized],
|
25
|
+
:current_session => options[:session]
|
26
|
+
})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/simple_auth/version.rb
CHANGED
data/simple_auth.gemspec
CHANGED
@@ -19,8 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_dependency "rails", ">= 3.0.0"
|
21
21
|
s.add_development_dependency "sqlite3-ruby"
|
22
|
-
s.add_development_dependency "rspec-rails", "~> 2.5
|
22
|
+
s.add_development_dependency "rspec-rails", "~> 2.5"
|
23
23
|
s.add_development_dependency "mongo_mapper", "~> 0.9.1"
|
24
24
|
s.add_development_dependency "bson_ext"
|
25
|
-
s.add_development_dependency "ruby-debug19"
|
26
25
|
end
|
@@ -43,7 +43,7 @@ describe ApplicationController do
|
|
43
43
|
|
44
44
|
it "should return the request url" do
|
45
45
|
get :index, :some => "param"
|
46
|
-
controller.send(:return_to, "/dashboard").should == "/
|
46
|
+
controller.send(:return_to, "/dashboard").should == "/anonymous?some=param"
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should return the default url" do
|
@@ -52,7 +52,7 @@ describe ApplicationController do
|
|
52
52
|
|
53
53
|
it "should set return to" do
|
54
54
|
get :index, :some => "param"
|
55
|
-
session[:return_to].should == "/
|
55
|
+
session[:return_to].should == "/anonymous?some=param"
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should remove return to from session" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70284204693240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70284204693240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &70284204691120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,21 +32,21 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70284204691120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &70284204983940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.5
|
43
|
+
version: '2.5'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70284204983940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: mongo_mapper
|
49
|
-
requirement: &
|
49
|
+
requirement: &70284204982160 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.9.1
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70284204982160
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bson_ext
|
60
|
-
requirement: &
|
60
|
+
requirement: &70284204980960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,18 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: ruby-debug19
|
71
|
-
requirement: &70122397413660 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- - ! '>='
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: *70122397413660
|
68
|
+
version_requirements: *70284204980960
|
80
69
|
description: A simple authentication system for Rails apps
|
81
70
|
email:
|
82
71
|
- fnando.vieira@gmail.com
|
@@ -99,6 +88,7 @@ files:
|
|
99
88
|
- lib/simple_auth/orm/base.rb
|
100
89
|
- lib/simple_auth/orm/mongo_mapper.rb
|
101
90
|
- lib/simple_auth/railtie.rb
|
91
|
+
- lib/simple_auth/rspec.rb
|
102
92
|
- lib/simple_auth/session.rb
|
103
93
|
- lib/simple_auth/version.rb
|
104
94
|
- locales/en.yml
|
@@ -137,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
127
|
version: '0'
|
138
128
|
segments:
|
139
129
|
- 0
|
140
|
-
hash: -
|
130
|
+
hash: -4357335546768423915
|
141
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
132
|
none: false
|
143
133
|
requirements:
|
@@ -146,10 +136,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
136
|
version: '0'
|
147
137
|
segments:
|
148
138
|
- 0
|
149
|
-
hash: -
|
139
|
+
hash: -4357335546768423915
|
150
140
|
requirements: []
|
151
141
|
rubyforge_project:
|
152
|
-
rubygems_version: 1.8.
|
142
|
+
rubygems_version: 1.8.11
|
153
143
|
signing_key:
|
154
144
|
specification_version: 3
|
155
145
|
summary: A simple authentication system for Rails apps
|