moro-repim 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +4 -0
- data/README.rdoc +15 -2
- data/generators/relying_party/relying_party_generator.rb +4 -3
- data/generators/relying_party/templates/spec/sessions_controller_spec.rb +13 -12
- data/generators/relying_party/templates/spec/sessions_routing_spec.rb +3 -3
- data/generators/relying_party/templates/spec/users_routing_spec.rb +6 -6
- data/lib/repim.rb +1 -1
- data/lib/repim/signup.rb +3 -3
- metadata +2 -2
data/ChangeLog
CHANGED
data/README.rdoc
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
= repim
|
3
3
|
|
4
|
-
|
5
4
|
== Description
|
6
5
|
|
7
|
-
|
6
|
+
repim (RElying Party In Minutes) is a rails plugin to
|
7
|
+
create websites using OpenID authentication easily.
|
8
8
|
|
9
9
|
== Installation
|
10
10
|
|
@@ -22,6 +22,19 @@ Relying Party in minutes.
|
|
22
22
|
|
23
23
|
== Synopsis
|
24
24
|
|
25
|
+
Generate template files
|
26
|
+
|
27
|
+
$ ruby script/generate relying_party Sessions name:string display_name:string
|
28
|
+
|
29
|
+
Edit config/environment.rb to load repim gem
|
30
|
+
|
31
|
+
config.gem 'moro-repim', :lib => 'repim', :source => 'http://gems.github.com/'
|
32
|
+
|
33
|
+
Start server
|
34
|
+
|
35
|
+
$ ruby script/server
|
36
|
+
|
37
|
+
You will see the login form in http://localhost:3000/signin .
|
25
38
|
|
26
39
|
== Copyright
|
27
40
|
|
@@ -34,9 +34,10 @@ class RelyingPartyGenerator < Rails::Generator::NamedBase
|
|
34
34
|
unless options[:skip_sessions_spec]
|
35
35
|
m.directory "spec/controllers"
|
36
36
|
m.file "spec/application_controller_spec.rb", "spec/controllers/application_controller_spec.rb"
|
37
|
-
|
38
37
|
m.file "spec/sessions_controller_spec.rb", "spec/controllers/#{controller_file_name}_spec.rb"
|
39
|
-
|
38
|
+
|
39
|
+
m.directory "spec/routing"
|
40
|
+
m.file "spec/sessions_routing_spec.rb", "spec/routing/#{plural_name}_routing_spec.rb"
|
40
41
|
end
|
41
42
|
|
42
43
|
generate_user_management(m, !options[:skip_sessions_spec]) unless options[:user_model_only]
|
@@ -108,7 +109,7 @@ EOS
|
|
108
109
|
|
109
110
|
if with_spec
|
110
111
|
m.file "spec/users_controller_spec.rb", "spec/controllers/#{user_controller_name}_spec.rb"
|
111
|
-
m.file "spec/users_routing_spec.rb", "spec/
|
112
|
+
m.file "spec/users_routing_spec.rb", "spec/routing/#{users}_routing_spec.rb"
|
112
113
|
end
|
113
114
|
end
|
114
115
|
end
|
@@ -15,6 +15,16 @@ describe SessionsController do
|
|
15
15
|
response.should be_success
|
16
16
|
end
|
17
17
|
|
18
|
+
def mock_out_authenticattion(controller, url, is_success)
|
19
|
+
result = mock("result")
|
20
|
+
result.should_receive(:successful?).and_return is_success
|
21
|
+
|
22
|
+
controller.
|
23
|
+
should_receive(:authenticate_with_open_id).
|
24
|
+
with(url, an_instance_of(Hash)).
|
25
|
+
and_return{|url, ax, block| block.call(result, url, ax) }
|
26
|
+
end
|
27
|
+
|
18
28
|
describe "authentication success" do
|
19
29
|
before do
|
20
30
|
url = "---openid-url---"
|
@@ -22,11 +32,8 @@ describe SessionsController do
|
|
22
32
|
@user = mock("user", :id => 12345)
|
23
33
|
SessionsController.user_klass.should_receive(:find_by_identity_url).with(url).and_return(@user)
|
24
34
|
|
25
|
-
result = mock("result")
|
26
|
-
result.should_receive(:successful?).and_return true
|
27
|
-
|
28
35
|
controller.should_receive(:root_path).and_return("/")
|
29
|
-
controller
|
36
|
+
mock_out_authenticattion(controller, url, true)
|
30
37
|
|
31
38
|
post :create, :openid_url =>url
|
32
39
|
end
|
@@ -43,10 +50,7 @@ describe SessionsController do
|
|
43
50
|
SessionsController.user_klass.should_receive(:find_by_identity_url).with(url).and_return(nil)
|
44
51
|
SessionsController.user_klass.should_receive(:new).with({}).and_return(@user = mock("user"))
|
45
52
|
|
46
|
-
|
47
|
-
result.should_receive(:successful?).and_return true
|
48
|
-
|
49
|
-
controller.should_receive(:authenticate_with_open_id).with(url, {}).and_yield(result,url, {})
|
53
|
+
mock_out_authenticattion(controller, url, true)
|
50
54
|
|
51
55
|
post :create, :openid_url =>url
|
52
56
|
end
|
@@ -61,10 +65,7 @@ describe SessionsController do
|
|
61
65
|
before do
|
62
66
|
url = "---openid-url---"
|
63
67
|
|
64
|
-
|
65
|
-
result.should_receive(:successful?).and_return false
|
66
|
-
|
67
|
-
controller.should_receive(:authenticate_with_open_id).with(url, {}).and_yield(result,url, {})
|
68
|
+
mock_out_authenticattion(controller, url, false)
|
68
69
|
|
69
70
|
post :create, :openid_url =>url
|
70
71
|
end
|
@@ -7,11 +7,11 @@ describe SessionsController do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should map #destroy -> /signout" do
|
10
|
-
route_for(:controller => "sessions", :action => "destroy").should == "/signout"
|
10
|
+
route_for(:controller => "sessions", :action => "destroy").should == {:path => "/signout", :method => "DELETE"}
|
11
11
|
end
|
12
12
|
|
13
|
-
it "should map #
|
14
|
-
route_for(:controller => "sessions", :action => "
|
13
|
+
it "should map #create" do
|
14
|
+
route_for(:controller => "sessions", :action => "create").should == {:path => "/session", :method => "POST"}
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -3,27 +3,27 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe UsersController do
|
4
4
|
describe "route generation" do
|
5
5
|
it "should map #index" do
|
6
|
-
route_for(:controller => "users", :action => "index").should == "/users"
|
6
|
+
route_for(:controller => "users", :action => "index").should == {:path => "/users", :method => "GET"}
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should map #new" do
|
10
|
-
route_for(:controller => "users", :action => "new").should == "/users/new"
|
10
|
+
route_for(:controller => "users", :action => "new").should == {:path => "/users/new", :method => "GET"}
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should map #show" do
|
14
|
-
route_for(:controller => "users", :action => "show", :id => 1).should == "/users/1"
|
14
|
+
route_for(:controller => "users", :action => "show", :id => "1").should == {:path => "/users/1", :method => "GET"}
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should map #edit" do
|
18
|
-
route_for(:controller => "users", :action => "edit", :id => 1).should == "/users/1/edit"
|
18
|
+
route_for(:controller => "users", :action => "edit", :id => "1").should == {:path => "/users/1/edit", :method => "GET"}
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should map #update" do
|
22
|
-
route_for(:controller => "users", :action => "update", :id => 1).should == "/users/1"
|
22
|
+
route_for(:controller => "users", :action => "update", :id => "1").should == {:path => "/users/1", :method => "PUT"}
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should map #destroy" do
|
26
|
-
route_for(:controller => "users", :action => "destroy", :id => 1).should == "/users/1"
|
26
|
+
route_for(:controller => "users", :action => "destroy", :id => "1").should == {:path => "/users/1", :method => "DELETE"}
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
data/lib/repim.rb
CHANGED
data/lib/repim/signup.rb
CHANGED
@@ -13,7 +13,7 @@ module Repim
|
|
13
13
|
flash[:notice] = 'User was successfully created.'
|
14
14
|
reset_session
|
15
15
|
self.current_user = @user
|
16
|
-
format.html { redirect_to(after_create_url) }
|
16
|
+
format.html { redirect_to(after_create_url(@user)) }
|
17
17
|
else
|
18
18
|
format.html { render :action => "new" }
|
19
19
|
end
|
@@ -21,8 +21,8 @@ module Repim
|
|
21
21
|
end
|
22
22
|
|
23
23
|
private
|
24
|
-
def after_create_url
|
25
|
-
root_url
|
24
|
+
def after_create_url(created)
|
25
|
+
respond_to?(:root_url) ? root_url : user_url(created)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moro-repim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MOROHASHI Kyosuke
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|