danski-ooh-auth 0.1.10 → 0.1.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,7 +34,7 @@ class OohAuth::Tokens < OohAuth::Application
34
34
  @token = OohAuth::Token.create_request_key(@authenticating_client)
35
35
  end
36
36
  # # Okay, no error raised. Gogo render.
37
- display @token, :show, :layout=>nil
37
+ display @token, :show, :layout=>false
38
38
  end
39
39
 
40
40
  def new
@@ -2,12 +2,12 @@
2
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
3
3
  <head>
4
4
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <title>Full-fat Auth Slice</title>
5
+ <title>OohAuth Slice</title>
6
6
  </head>
7
7
  <!-- you can override this layout at slices/ooh-auth/app/views/layout/ooh-auth.html.erb -->
8
8
  <body class="ooh-auth">
9
9
  <div id="root">
10
- <h1>Full-fat Auth Slice</h1>
10
+ <h1>OohAuth Slice</h1>
11
11
 
12
12
  <% unless message.blank? %>
13
13
  <div id="_message">
data/lib/ooh-auth.rb CHANGED
@@ -2,12 +2,12 @@ if defined?(Merb::Plugins)
2
2
 
3
3
  $:.unshift File.dirname(__FILE__)
4
4
 
5
- load_dependency "merb-action-args"
6
- load_dependency 'merb-auth-core'
7
- load_dependency 'merb-auth-more'
8
- load_dependency 'merb-slices'
9
- load_dependency "merb-helpers"
10
- load_dependency "merb-assets"
5
+ dependency "merb-action-args"
6
+ dependency 'merb-auth-core'
7
+ dependency 'merb-auth-more'
8
+ dependency 'merb-slices'
9
+ dependency "merb-helpers"
10
+ dependency "merb-assets"
11
11
 
12
12
  Merb::Plugins.add_rakefiles "ooh-auth/merbtasks", "ooh-auth/slicetasks", "ooh-auth/spectasks"
13
13
 
@@ -47,7 +47,7 @@ if defined?(Merb::Plugins)
47
47
 
48
48
  # Slice metadata
49
49
  self.description = "OohAuth is Merb slice that extends merb-auth-more with RESTful authentication"
50
- self.version = "0.0.1"
50
+ self.version = "0.1.2"
51
51
  self.author = "Dan Glegg"
52
52
  self.identifier = "ooh-auth"
53
53
 
@@ -27,10 +27,10 @@ describe OohAuth::AuthenticatingClients do
27
27
  @user = user_class.gen
28
28
 
29
29
  @bad_authenticating_client_attrs = OohAuth::AuthenticatingClient.gen.attributes
30
- [:name].each {|a| @bad_authenticating_client_attrs.delete(a) }
30
+ [:name, :user_id].each {|a| @bad_authenticating_client_attrs.delete(a) }
31
31
 
32
32
  @good_authenticating_client_attrs = OohAuth::AuthenticatingClient.gen(:kind=>"desktop").attributes
33
- [:id, :secret, :api_key].each {|a| @good_authenticating_client_attrs.delete(a) }
33
+ [:id, :secret, :api_key, :user_id].each {|a| @good_authenticating_client_attrs.delete(a) }
34
34
  @good_authenticating_client_attrs[:name] = "unique fo realz"
35
35
 
36
36
  @controller = OohAuth::AuthenticatingClients.new(Merb::Test::RequestHelper::FakeRequest.new)
@@ -53,17 +53,13 @@ describe OohAuth::AuthenticatingClients do
53
53
  @controller.headers['Location'].should == @controller.slice_url(:authenticating_client, @controller.assigns(:authenticating_client))
54
54
  (ac_count + 1).should == OohAuth::AuthenticatingClient.count
55
55
  end
56
- it "should assign the authenticated user's ID regardless of user_id in the form data" do
57
- @controller.create(@good_authenticating_client_attrs.merge(:user_id=>@user.id+1000))
58
- @controller.assigns(:authenticating_client).user_id.should == @user.id
59
- end
60
56
  end
61
57
 
62
58
  describe "show action" do
63
59
  before :each do
64
60
  @user = user_class.gen
65
- @authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id)
66
- @other_authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id+1000)
61
+ @authenticating_client = OohAuth::AuthenticatingClient.gen(:user=>@user)
62
+ @other_authenticating_client = OohAuth::AuthenticatingClient.gen
67
63
  @controller = OohAuth::AuthenticatingClients.new(Merb::Test::RequestHelper::FakeRequest.new)
68
64
  @controller.request.session.user = @user
69
65
  end
@@ -80,8 +76,8 @@ describe OohAuth::AuthenticatingClients do
80
76
  describe "edit/update action" do
81
77
  before :each do
82
78
  @user = user_class.gen
83
- @authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id)
84
- @other_authenticating_client = OohAuth::AuthenticatingClient.gen(:user_id=>@user.id+1000)
79
+ @authenticating_client = OohAuth::AuthenticatingClient.gen(:user=>@user)
80
+ @other_authenticating_client = OohAuth::AuthenticatingClient.gen
85
81
  @controller = OohAuth::AuthenticatingClients.new(Merb::Test::RequestHelper::FakeRequest.new)
86
82
  @controller.request.session.user = @user
87
83
  end
@@ -26,7 +26,7 @@ describe OohAuth::Tokens do
26
26
  describe "index action" do
27
27
  %w(js yaml xml html).each do |format|
28
28
  it "#{format} requests should generate an anonymous receipt when sent GET with a consumer and no other information." do
29
- @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens), :format=>format))
29
+ @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens, :format=>format)))
30
30
  @controller.should be_successful
31
31
  request_token = @controller.assigns(:token)
32
32
  request_token.should be_kind_of(OohAuth::Token)
@@ -36,10 +36,11 @@ describe OohAuth::Tokens do
36
36
  end
37
37
 
38
38
  it "should return OAuth-format key responses if no format is specified" do
39
- @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens)))
39
+ @controller = get(sign_url_with(@authenticating_client, @controller.slice_url(:tokens, :format=>"html")))
40
40
  request_token = @controller.assigns(:token)
41
41
  @controller.body.should == "oauth_token=#{request_token.token_key}&oauth_token_secret=#{request_token.secret}"
42
42
  end
43
+
43
44
 
44
45
  it "should generate nothing and return a 406 not acceptable when the request is not signed or contains an incorrect API key" do
45
46
  lambda {get(@controller.slice_url(:tokens, :oauth_consumer_key=>@authenticating_client.api_key))}.should raise_error(Merb::Controller::NotAcceptable)
@@ -40,11 +40,5 @@ describe OohAuth::AuthenticatingClient do
40
40
  arr = OohAuth::AuthenticatingClient.find_for_user(nil)
41
41
  arr.length.should == 0
42
42
  end
43
-
44
- it "should return a list of authenticating clients when find_for_user is called with a valid user" do
45
- @authenticating_clients = 10.of {OohAuth::AuthenticatingClient.gen(:user_id=>@user.id)}
46
- arr = OohAuth::AuthenticatingClient.find_for_user(@user)
47
- arr.length.should == 10
48
- end
49
43
 
50
44
  end
@@ -7,7 +7,6 @@ OohAuth::Mocks::User.fixture{{
7
7
  }}
8
8
 
9
9
  OohAuth::AuthenticatingClient.fixture{{
10
- :user_id => /\d{1,3}/.gen,
11
10
  :name => /\w+/.gen,
12
11
  :web_url => "http://www.#{ /\w+/.gen }.com/client/",
13
12
  :api_key => /\w+/.gen,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danski-ooh-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Glegg