Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
diaspora
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milan
diaspora
Commits
2893c376
Commit
2893c376
authored
14 years ago
by
Raphael
Browse files
Options
Downloads
Patches
Plain Diff
Delete em-webfinger file from other branch
parent
d8fc7d57
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/lib/em-webfinger_spec.rb
+0
-103
0 additions, 103 deletions
spec/lib/em-webfinger_spec.rb
with
0 additions
and
103 deletions
spec/lib/em-webfinger_spec.rb
deleted
100644 → 0
+
0
−
103
View file @
d8fc7d57
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require
'spec_helper'
require
File
.
join
(
Rails
.
root
,
'lib/em-webfinger'
)
describe
EMWebfinger
do
let
(
:user1
)
{
Factory
(
:user
)
}
let
(
:user2
)
{
Factory
(
:user
)
}
let
(
:account
)
{
"tom@tom.joindiaspora.com"
}
let
(
:finger
){
EMWebfinger
.
new
(
account
)}
let
(
:person
){
Factory
(
:person
)
}
let
(
:good_request
)
{
FakeHttpRequest
.
new
(
:success
)}
let
(
:bad_request
)
{
FakeHttpRequest
.
new
(
:failure
)}
let
(
:stub_good
)
{
EventMachine
::
HttpRequest
.
stub!
(
:new
).
and_return
(
good_request
)}
let
(
:stub_bad
)
{
EventMachine
::
HttpRequest
.
stub!
(
:new
).
and_return
(
bad_request
)}
let
(
:diaspora_xrd
)
{
File
.
open
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/host_xrd'
))}
let
(
:diaspora_finger
)
{
File
.
open
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/finger_xrd'
))}
let
(
:hcard_xml
)
{
File
.
open
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/hcard_response'
))}
let
(
:non_diaspora_xrd
)
{
File
.
open
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/nonseed_finger_xrd'
))}
let
(
:non_diaspora_hcard
)
{
File
.
open
(
File
.
join
(
Rails
.
root
,
'spec/fixtures/evan_hcard'
))}
context
'setup'
do
let
(
:action
){
Proc
.
new
{
|
person
|
puts
person
.
inspect
}}
describe
'#intialize'
do
it
'sets account '
do
n
=
EMWebfinger
.
new
(
"mbs348@gmail.com"
)
n
.
instance_variable_get
(
:@account
).
should_not
be
nil
end
it
'should raise an error on an unresonable email'
do
pending
proc
{
EMWebfinger
.
new
(
"asfadfasdf"
)}.
should
raise_error
end
end
describe
'#on_person'
do
it
'should set a callback'
do
n
=
EMWebfinger
.
new
(
"mbs@gmail.com"
)
n
.
on_person
{
|
person
|
puts
"foo"
}
n
.
instance_variable_get
(
:@callbacks
).
count
.
should
be
1
end
end
describe
'#fetch'
do
it
'should require a callback'
do
proc
{
finger
.
fetch
}.
should
raise_error
"you need to set a callback before calling fetch"
end
it
'should'
end
end
context
'webfinger query chain processing'
do
describe
'#webfinger_profile_url'
do
it
'should parse out the webfinger template'
do
finger
.
webfinger_profile_url
(
account
,
diaspora_xrd
).
should
==
"http://example.com/webfinger/?q=
#{
account
}
"
end
end
describe
'#xrd_url'
do
it
'should return canonical host-meta url'
do
finger
.
xrd_url
(
account
).
should
be
"http://tom.joindiaspora.com/.well-known/host-meta"
end
it
'can return the https version'
do
finger
.
xrd_url
(
account
,
true
).
should
be
"https://tom.joindiaspora.com/.well-known/host-meta"
end
end
end
context
'webfingering local people'
do
it
'should return a person from the database if it matches its handle'
do
pending
end
end
end
class
FakeHttpRequest
def
initialize
(
callback_wanted
)
@callback
=
callback_wanted
end
def
response
end
def
post
;
end
def
get
;
end
def
callback
(
&
b
)
b
.
call
if
@callback
==
:success
end
def
errback
(
&
b
)
b
.
call
if
@callback
==
:failure
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment