1
$:.unshift(File.dirname(__FILE__))
4
describe "openid plugin w/" do
5
def setup_open_id_plugin(service, userid)
6
fake_plugin(:openid) { |plugin|
8
plugin.conf['openid.service'] = service
9
plugin.conf['openid.id'] = userid
15
plugin = setup_open_id_plugin('Hatena', 'tdtds')
16
@header_snippet = plugin.header_proc
19
it { @header_snippet.should include_link_tag_with(
20
:rel => 'openid.server',
21
:href => 'https://www.hatena.ne.jp/openid/server')}
23
it { @header_snippet.should include_link_tag_with(
24
:rel => 'openid.delegate',
25
:href => 'http://www.hatena.ne.jp/tdtds/')}
28
describe "livedoor" do
30
plugin = setup_open_id_plugin('livedoor', 'tdtds')
31
@header_snippet = plugin.header_proc
34
it { @header_snippet.should include_link_tag_with(
35
:rel => 'openid.server',
36
:href => 'http://auth.livedoor.com/openid/server')}
38
it { @header_snippet.should include_link_tag_with(
39
:rel => 'openid.delegate',
40
:href => 'http://profile.livedoor.com/tdtds')}
43
describe "LiveJournal" do
45
plugin = setup_open_id_plugin('LiveJournal', 'tdtds')
46
@header_snippet = plugin.header_proc
49
it { @header_snippet.should include_link_tag_with(
50
:rel => 'openid.server',
51
:href => 'http://www.livejournal.com/openid/server.bml')}
53
it { @header_snippet.should include_link_tag_with(
54
:rel => 'openid.delegate',
55
:href => 'http://tdtds.livejournal.com/')}
59
describe "OpenID.ne.jp" do
61
plugin = setup_open_id_plugin('OpenID.ne.jp', 'tdtds')
62
@header_snippet = plugin.header_proc
65
it { @header_snippet.should include_link_tag_with(
66
:rel => 'openid.server',
67
:href => 'http://www.openid.ne.jp/user/auth')}
69
it { @header_snippet.should include_link_tag_with(
70
:rel => 'openid.delegate',
71
:href => 'http://tdtds.openid.ne.jp')}
73
it { @header_snippet.should include_xrds_meta_tag_with(
74
:content => 'http://tdtds.openid.ne.jp/user/xrds')}
80
plugin = setup_open_id_plugin('TypeKey', 'tdtds')
81
@header_snippet = plugin.header_proc
84
it { @header_snippet.should include_link_tag_with(
85
:rel => 'openid.server',
86
:href => 'http://www.typekey.com/t/openid/')}
88
it { @header_snippet.should include_link_tag_with(
89
:rel => 'openid.delegate',
90
:href => 'http://profile.typekey.com/tdtds/')}
94
describe "Videntity.org" do
96
plugin = setup_open_id_plugin('Videntity.org', 'tdtds')
97
@header_snippet = plugin.header_proc
100
it { @header_snippet.should include_link_tag_with(
101
:rel => 'openid.server',
102
:href => 'http://videntity.org/serverlogin?action=openid')}
104
it { @header_snippet.should include_link_tag_with(
105
:rel => 'openid.delegate',
106
:href => 'http://tdtds.videntity.org/')}
112
plugin = setup_open_id_plugin('Vox', 'tdtds')
113
@header_snippet = plugin.header_proc
116
it { @header_snippet.should include_link_tag_with(
117
:rel => 'openid.server',
118
:href => 'http://www.vox.com/services/openid/server')}
120
it { @header_snippet.should include_link_tag_with(
121
:rel => 'openid.delegate',
122
:href => 'http://tdtds.vox.com/')}
125
describe "myopenid.com" do
127
@plugin = setup_open_id_plugin('myopenid.com', 'tdtds')
128
@header_snippet = @plugin.header_proc
131
it { @header_snippet.should include_xrds_meta_tag_with(
132
:content => "http://www.myopenid.com/xrds?username=tdtds")}
134
it { @header_snippet.should include_link_tag_with(
135
:rel => "openid.server",
136
:href => "http://www.myopenid.com/server")}
138
it { @header_snippet.should include_link_tag_with(
139
:rel => "openid.delegate",
140
:href => "http://tdtds.myopenid.com")}
142
it { @header_snippet.should include_link_tag_with(
143
:rel => "openid2.provider",
144
:href => "http://www.myopenid.com/server")}
146
it { @header_snippet.should include_link_tag_with(
147
:rel => "openid2.local_id",
148
:href => "http://tdtds.myopenid.com")}
151
describe "claimID.com" do
153
@plugin = setup_open_id_plugin('claimID.com', 'tdtds')
154
@header_snippet = @plugin.header_proc
157
it { @header_snippet.should include_xrds_meta_tag_with(
158
:content => "http://claimid.com/tdtds/xrds")}
160
it { @header_snippet.should include_link_tag_with(
161
:rel => "openid.server",
162
:href => "http://openid.claimid.com/server")}
164
it { @header_snippet.should include_link_tag_with(
165
:rel => "openid.delegate",
166
:href => "http://openid.claimid.com/tdtds")}
169
describe "Personal Identity Provider (PIP)" do
171
@plugin = setup_open_id_plugin('Personal Identity Provider (PIP)', 'tdtds')
172
@header_snippet = @plugin.header_proc
175
it { @header_snippet.should include_xrds_meta_tag_with(
176
:content => "http://pip.verisignlabs.com/user/tdtds/yadisxrds")}
178
it { @header_snippet.should include_link_tag_with(
179
:rel => "openid.server",
180
:href => "http://pip.verisignlabs.com/server")}
182
it { @header_snippet.should include_link_tag_with(
183
:rel => "openid.delegate",
184
:href => "http://tdtds.pip.verisignlabs.com/")}
186
it { @header_snippet.should include_link_tag_with(
187
:rel => "openid2.provider",
188
:href => "http://pip.verisignlabs.com/server")}
190
it { @header_snippet.should include_link_tag_with(
191
:rel => "openid2.local_id",
192
:href => "http://tdtds.pip.verisignlabs.com/")}
195
describe "Yahoo! Japan" do
197
plugin = setup_open_id_plugin('Yahoo! Japan', 'tdtds')
198
@header_snippet = plugin.header_proc
201
it { @header_snippet.should include_link_tag_with(
202
:rel => 'openid2.provider',
203
:href => 'https://open.login.yahooapis.jp/openid/op/auth')}
205
it { @header_snippet.should include_link_tag_with(
206
:rel => 'openid2.local_id',
207
:href => 'https://me.yahoo.co.jp/a/tdtds')}
209
it { @header_snippet.should_not include_link_tag_with(
210
:rel => "openid.server")}
212
it { @header_snippet.should_not include_link_tag_with(
213
:rel => "openid.delegate")}
219
plugin = setup_open_id_plugin('Yahoo!', 'tdtds')
220
@header_snippet = plugin.header_proc
223
it { @header_snippet.should include_link_tag_with(
224
:rel => 'openid2.provider',
225
:href => 'https://open.login.yahooapis.com/openid/op/auth')}
227
it { @header_snippet.should include_link_tag_with(
228
:rel => 'openid2.local_id',
229
:href => 'https://me.yahoo.com/a/tdtds')}
231
it { @header_snippet.should_not include_link_tag_with(
232
:rel => "openid.server")}
234
it { @header_snippet.should_not include_link_tag_with(
235
:rel => "openid.delegate")}
240
plugin = setup_open_id_plugin('Wassr', 'tdtds')
241
@header_snippet = plugin.header_proc
244
it { @header_snippet.should include_link_tag_with(
245
:rel => 'openid.server',
246
:href => 'https://wassr.jp/open_id/auth')}
248
it { @header_snippet.should include_link_tag_with(
249
:rel => 'openid.delegate',
250
:href => 'https://wassr.jp/user/tdtds')}
253
def include_link_tag_with(options)
254
msg = "include #{options[:rel]} link tag"
255
expected = %|<link rel="#{options[:rel]}"| if options[:rel]
256
expected <<= %| href="#{options[:href]}">| if options[:href]
257
Spec::Matchers::SimpleMatcher.new(msg) do |actual|
258
actual.include?( expected )
262
def include_xrds_meta_tag_with(options)
263
msg = "include XRDS meta tag"
264
expected = (<<-"EOS").chomp
265
<meta http-equiv="X-XRDS-Location" content="#{options[:content]}">
267
Spec::Matchers::SimpleMatcher.new(msg) do |actual|
268
actual.include?( expected )