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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e82edb6ef74a5709ce6bc6b52dc8f38663f6e3f
4
- data.tar.gz: 4866eb8bb8b92af6af344ca893199b761af37301
3
+ metadata.gz: 921b05c601dc7466f898db7e85a7f7b85f4475d5
4
+ data.tar.gz: f90521cd20b2d2ccb85174cd218606f324aa249b
5
5
  SHA512:
6
- metadata.gz: e9742f0902f3269476238ea3874414e482000c7140126e84d09f78772709e511a61a29bcbd0b569dd25946c51afdc8e1a6148beeecf6d0b8ef2583be177891a4
7
- data.tar.gz: ea05ba2834cd456bc125ff40ad8af801cea184b3f283fb85102e87f5b613a2206448ad9aa670d3cd2b4f121ac572d2fea816245b7a67300487eeb349f804b5a5
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-shop for authentication.
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
 
@@ -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-shop for authentication.}
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
 
@@ -1,3 +1,3 @@
1
1
  module Autho
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -2,5 +2,45 @@ require "spec_helper"
2
2
  require "autho/session"
3
3
 
4
4
  describe Autho::Session do
5
- it "needs specs"
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.2
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-shop for authentication.
126
+ summary: A many-stop shop for authentication.
127
127
  test_files:
128
128
  - spec/authentication_spec.rb
129
129
  - spec/session_spec.rb