mc-openid 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mc-openid (0.0.1)
4
+ mc-openid (0.0.4)
5
5
  ruby-openid-apps-discovery (= 1.2.0)
6
6
 
7
7
  GEM
@@ -6,14 +6,17 @@ module ModCloth
6
6
  include ::OpenIdAuthentication
7
7
 
8
8
 
9
- def check_openid
10
- open_id_authentication("https://www.google.com/accounts/o8/site-xrds?hd=modcloth.com")
9
+ def check_openid(routes)
10
+ open_id_authentication("https://www.google.com/accounts/o8/site-xrds?hd=modcloth.com", routes)
11
11
  end
12
12
 
13
- def open_id_authentication(openid_url)
13
+ def open_id_authentication(openid_url, routes)
14
14
  authenticate_with_open_id(openid_url, [{:name => :email, :uri => 'http://axschema.org/contact/email'}]) do |result, identity_url, registration|
15
15
  if result.successful?
16
16
  session[:user_email] = registration.data['http://axschema.org/contact/email'].first
17
+ redirect_to routes[:success]
18
+ else
19
+ redirect_to routes[:fail]
17
20
  end
18
21
  end
19
22
  end
@@ -1,5 +1,5 @@
1
1
  module ModCloth
2
2
  module OpenID
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -19,16 +19,11 @@ describe ModCloth::OpenID do
19
19
  describe "authentication" do
20
20
  it "return successful if open id authentication passes" do
21
21
  open_id_consumer = mock()
22
+ routes = { :success => '/', :fail => '/'}
22
23
  @controller.stub!(:session).and_return({})
23
24
  @controller.stub!(:open_id_consumer).and_return(open_id_consumer)
24
25
  @controller.stub!(:begin_open_id_authentication).and_return({:user_email => "test@modcloth.com"})
25
- @controller.check_openid.should == {:user_email => "test@modcloth.com"}
26
- end
27
-
28
- it "return successful if exist a session" do
29
- session = {:user_email =>"test@modcloth.com"}
30
- @controller.stub!(:session).and_return(session)
31
- @controller.check_openid.should == session
26
+ @controller.check_openid(routes).should == {:user_email => "test@modcloth.com"}
32
27
  end
33
28
  end
34
29
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mc-openid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luis Flores, Juan Esparza, Rudy Sombillo, Sergio Figueroa
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-26 00:00:00 -08:00
18
+ date: 2011-02-01 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency