zendesk_remote_auth 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/zendesk_remote_auth.rb +1 -0
- data/zendesk_remote_auth.gemspec +5 -5
- metadata +8 -17
- data/spec/spec_helper.rb +0 -4
- data/spec/zendesk_remote_auth_spec.rb +0 -105
data/Rakefile
CHANGED
@@ -10,7 +10,7 @@ begin
|
|
10
10
|
gem.email = "tcrawley@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/tobias/zendesk_remote_auth"
|
12
12
|
gem.authors = ["Tobias Crawley"]
|
13
|
-
gem.add_dependency "
|
13
|
+
gem.add_dependency "activesupport", ">= 3.0.0"
|
14
14
|
gem.add_development_dependency "rspec", ">= 2.6.0"
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/lib/zendesk_remote_auth.rb
CHANGED
@@ -73,6 +73,7 @@ module Zendesk
|
|
73
73
|
str_to_hash << params[:email]
|
74
74
|
str_to_hash << params[:external_id].to_s if params[:external_id]
|
75
75
|
str_to_hash << params[:organization].to_s if params[:organization]
|
76
|
+
str_to_hash << params[:tags].to_s if params[:tags]
|
76
77
|
str_to_hash << params[:remote_photo_url].to_s if params[:remote_photo_url]
|
77
78
|
str_to_hash << token
|
78
79
|
str_to_hash << params[:timestamp].to_s
|
data/zendesk_remote_auth.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{zendesk_remote_auth}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Tobias Crawley}]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-12-14}
|
13
13
|
s.description = %q{See the README.}
|
14
14
|
s.email = %q{tcrawley@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -34,14 +34,14 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.specification_version = 3
|
35
35
|
|
36
36
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
37
|
-
s.add_runtime_dependency(%q<
|
37
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
|
38
38
|
s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
|
39
39
|
else
|
40
|
-
s.add_dependency(%q<
|
40
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
41
41
|
s.add_dependency(%q<rspec>, [">= 2.6.0"])
|
42
42
|
end
|
43
43
|
else
|
44
|
-
s.add_dependency(%q<
|
44
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
45
45
|
s.add_dependency(%q<rspec>, [">= 2.6.0"])
|
46
46
|
end
|
47
47
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_remote_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
4
|
+
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
7
|
+
- 1
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
9
|
+
version: 1.1.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Tobias Crawley
|
@@ -15,17 +14,16 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-
|
17
|
+
date: 2011-12-14 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: activesupport
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
27
26
|
- !ruby/object:Gem::Version
|
28
|
-
hash: 7
|
29
27
|
segments:
|
30
28
|
- 3
|
31
29
|
- 0
|
@@ -37,11 +35,9 @@ dependencies:
|
|
37
35
|
name: rspec
|
38
36
|
prerelease: false
|
39
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
38
|
requirements:
|
42
39
|
- - ">="
|
43
40
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 23
|
45
41
|
segments:
|
46
42
|
- 2
|
47
43
|
- 6
|
@@ -65,9 +61,8 @@ files:
|
|
65
61
|
- Rakefile
|
66
62
|
- VERSION
|
67
63
|
- lib/zendesk_remote_auth.rb
|
68
|
-
- spec/spec_helper.rb
|
69
|
-
- spec/zendesk_remote_auth_spec.rb
|
70
64
|
- zendesk_remote_auth.gemspec
|
65
|
+
has_rdoc: true
|
71
66
|
homepage: http://github.com/tobias/zendesk_remote_auth
|
72
67
|
licenses: []
|
73
68
|
|
@@ -77,27 +72,23 @@ rdoc_options: []
|
|
77
72
|
require_paths:
|
78
73
|
- lib
|
79
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
75
|
requirements:
|
82
76
|
- - ">="
|
83
77
|
- !ruby/object:Gem::Version
|
84
|
-
hash: 3
|
85
78
|
segments:
|
86
79
|
- 0
|
87
80
|
version: "0"
|
88
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
82
|
requirements:
|
91
83
|
- - ">="
|
92
84
|
- !ruby/object:Gem::Version
|
93
|
-
hash: 3
|
94
85
|
segments:
|
95
86
|
- 0
|
96
87
|
version: "0"
|
97
88
|
requirements: []
|
98
89
|
|
99
90
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.3.6
|
101
92
|
signing_key:
|
102
93
|
specification_version: 3
|
103
94
|
summary: Helper for Zendesk SSO/remote authentication
|
data/spec/spec_helper.rb
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Zendesk::RemoteAuth do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@auth = Object.new
|
7
|
-
@auth.extend(Zendesk::RemoteAuthHelper)
|
8
|
-
end
|
9
|
-
|
10
|
-
context 'RemoteAuth' do
|
11
|
-
before(:each) do
|
12
|
-
Zendesk::RemoteAuth.token = Zendesk::RemoteAuth.auth_url = nil
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should raise exception if token is not set' do
|
16
|
-
lambda{ Zendesk::RemoteAuth.token }.should raise_error(ArgumentError)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should return the token without exception if it is set' do
|
20
|
-
Zendesk::RemoteAuth.token = 'blah'
|
21
|
-
Zendesk::RemoteAuth.token.should == 'blah'
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
it 'should raise exception if auth_url is not set' do
|
26
|
-
lambda { Zendesk::RemoteAuth.auth_url }.should raise_error(ArgumentError)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should return the auth_url without exception if it is set' do
|
30
|
-
Zendesk::RemoteAuth.auth_url = 'blah'
|
31
|
-
Zendesk::RemoteAuth.auth_url.should == 'blah'
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
context 'url generation' do
|
37
|
-
before(:each) do
|
38
|
-
Zendesk::RemoteAuth.token = 'the_token'
|
39
|
-
Zendesk::RemoteAuth.auth_url = 'the_url'
|
40
|
-
@valid_params = { :email => 'test@example.com', :name => 'blah'}
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'required fields' do
|
44
|
-
it 'should raise an argument error the name is not provided' do
|
45
|
-
lambda {
|
46
|
-
@valid_params.delete(:name)
|
47
|
-
@auth.zendesk_remote_auth_url(@valid_params)
|
48
|
-
}.should raise_error(ArgumentError)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should raise an argument error the email is not provided' do
|
52
|
-
lambda {
|
53
|
-
@valid_params.delete(:email)
|
54
|
-
@auth.zendesk_remote_auth_url(@valid_params)
|
55
|
-
}.should raise_error(ArgumentError)
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should return a url that starts with the auth_url' do
|
61
|
-
@auth.zendesk_remote_auth_url(@valid_params)
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should have an empty hash param if external_id not provided' do
|
65
|
-
@auth.zendesk_remote_auth_url(@valid_params).should =~ /hash=(&|$)/
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should have a hash param if external_id provided' do
|
69
|
-
@auth.zendesk_remote_auth_url(@valid_params.merge(:external_id => 'id')).should_not =~ /hash=(&|$)/
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'should have a different hash param if external_id and remote_photo_url provided ' do
|
73
|
-
a=@auth.zendesk_remote_auth_url(@valid_params.merge(:external_id => 'id')).match(/(hash=[^&]*)/)[1]
|
74
|
-
b=@auth.zendesk_remote_auth_url(@valid_params.merge(:external_id => 'id', :remote_photo_url => 'photo_url')).match(/(hash=[^&]*)/)[1]
|
75
|
-
a.should_not == b
|
76
|
-
end
|
77
|
-
|
78
|
-
context 'given a user object' do
|
79
|
-
before(:each) do
|
80
|
-
@user = mock
|
81
|
-
@user.should_receive(:name).and_return('a_name')
|
82
|
-
@user.should_receive(:email).and_return('an_email')
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'should pull the name from the user' do
|
86
|
-
@auth.zendesk_remote_auth_url(@user).should =~ /name=a_name/
|
87
|
-
end
|
88
|
-
|
89
|
-
it 'should pull the email from the user' do
|
90
|
-
@auth.zendesk_remote_auth_url(@user).should =~ /email=an_email/
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'should pull the id from the user' do
|
94
|
-
@user.should_receive(:id).and_return('an_id')
|
95
|
-
@auth.zendesk_remote_auth_url(@user).should =~ /external_id=an_id/
|
96
|
-
end
|
97
|
-
|
98
|
-
it 'should pull the organization from the user if available' do
|
99
|
-
@user.should_receive(:zendesk_organization).and_return('org')
|
100
|
-
@auth.zendesk_remote_auth_url(@user).should =~ /organization=org/
|
101
|
-
end
|
102
|
-
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|