autho 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/autho.gemspec +1 -1
- data/lib/autho/version.rb +1 -1
- data/spec/session_spec.rb +41 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 921b05c601dc7466f898db7e85a7f7b85f4475d5
|
4
|
+
data.tar.gz: f90521cd20b2d2ccb85174cd218606f324aa249b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f159369ac5aeefdb2d92b922ab6224220cfa803bf8c2c9d89aff576e8e3c889377df91c633100790c09d57855560aa8c2175968f0d93893ea7aa195008a5e65a
|
7
|
+
data.tar.gz: 40b801be856023713d7639c2308a88dc03011288225778c6c0b07b875665556227d76694ca60d9e9f34ea2090b65e7f43231b9ab394f176b1d45051495ed4fca
|
data/README.md
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
**NOTE:** Very much a work in progress.
|
4
4
|
|
5
|
-
A many-stop
|
5
|
+
A many-stop shop for authentication.
|
6
6
|
|
7
7
|
I've looked at various authentication gems and feel they do too much. I don't want a framework where I override some things. I want a helpful library to handle some things and leave me to bring it all together.
|
8
8
|
|
9
9
|
If you agree, Autho may be for you.
|
10
10
|
|
11
|
-
Autho is made to work well with Rails but not to be tied to it.
|
11
|
+
Autho is made to work well with Rails and Active Record but not to be tied to it. We're using it with [Minimapper](http://github.com/joakimk/minimapper) on one project.
|
12
12
|
|
13
13
|
## Installation
|
14
14
|
|
data/autho.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Autho::VERSION
|
9
9
|
spec.authors = ["Henrik Nyh"]
|
10
10
|
spec.email = ["henrik@nyh.se"]
|
11
|
-
spec.summary = %q{A many-stop
|
11
|
+
spec.summary = %q{A many-stop shop for authentication.}
|
12
12
|
spec.homepage = "http://github.com/henrik/autho"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
data/lib/autho/version.rb
CHANGED
data/spec/session_spec.rb
CHANGED
@@ -2,5 +2,45 @@ require "spec_helper"
|
|
2
2
|
require "autho/session"
|
3
3
|
|
4
4
|
describe Autho::Session do
|
5
|
-
|
5
|
+
|
6
|
+
describe "#user" do
|
7
|
+
let(:finder) { double }
|
8
|
+
|
9
|
+
it "finds a user by ID in session" do
|
10
|
+
controller = double(session: { my_user_id: 1 })
|
11
|
+
user = double
|
12
|
+
expect(finder).to receive(:find).with(1).and_return(user)
|
13
|
+
|
14
|
+
session = Autho::Session.new(controller, :my_user_id, finder)
|
15
|
+
expect(session.user).to eq user
|
16
|
+
end
|
17
|
+
|
18
|
+
it "finds nothing if there's no id in session" do
|
19
|
+
controller = double(session: {})
|
20
|
+
|
21
|
+
session = Autho::Session.new(controller, :my_user_id, finder)
|
22
|
+
expect(session.user).to be_nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#user=" do
|
27
|
+
it "stores the user ID in the session" do
|
28
|
+
controller = double(session: {})
|
29
|
+
user = double(id: 1)
|
30
|
+
|
31
|
+
session = Autho::Session.new(controller, :my_user_id, nil)
|
32
|
+
session.user = user
|
33
|
+
expect(controller.session[:my_user_id]).to eq 1
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#clear" do
|
38
|
+
it "clears the user ID in the session" do
|
39
|
+
controller = double(session: {id: 1})
|
40
|
+
|
41
|
+
session = Autho::Session.new(controller, :my_user_id, nil)
|
42
|
+
session.clear
|
43
|
+
expect(controller.session[:my_user_id]).to be_nil
|
44
|
+
end
|
45
|
+
end
|
6
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
@@ -123,7 +123,7 @@ rubyforge_project:
|
|
123
123
|
rubygems_version: 2.0.3
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
|
-
summary: A many-stop
|
126
|
+
summary: A many-stop shop for authentication.
|
127
127
|
test_files:
|
128
128
|
- spec/authentication_spec.rb
|
129
129
|
- spec/session_spec.rb
|