forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hotsh#601 from wilkie/bugfix/salmon-links-in-xrds
Bugfix/salmon links in xrds
- Loading branch information
Showing
2 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,40 @@ | |
describe "Webfinger" do | ||
include AcceptanceHelper | ||
|
||
describe "user xrd" do | ||
before do | ||
@user = Fabricate(:user) | ||
@subject = "acct:#{@user.username}@#{@user.author.domain}" | ||
get "/users/#{@subject}/xrd.xml" | ||
if last_response.status == 301 | ||
follow_redirect! | ||
end | ||
|
||
@xml = Nokogiri.XML(last_response.body) | ||
end | ||
|
||
it "contains the salmon url" do | ||
regex = /^http(?:s)?:\/\/.*\/feeds\/#{@user.feed.id}\/salmon$/ | ||
profile_rel = "salmon" | ||
profile_uri = @xml.xpath("//xmlns:Link[@rel='#{profile_rel}']") | ||
profile_uri.first.attr("href").must_match regex | ||
end | ||
|
||
it "contains the salmon-replies url" do | ||
regex = /^http(?:s)?:\/\/.*\/feeds\/#{@user.feed.id}\/salmon$/ | ||
profile_rel = "http://salmon-protocol.org/ns/salmon-replies" | ||
profile_uri = @xml.xpath("//xmlns:Link[@rel='#{profile_rel}']") | ||
profile_uri.first.attr("href").must_match regex | ||
end | ||
|
||
it "contains the salmon-mention url" do | ||
regex = /^http(?:s)?:\/\/.*\/feeds\/#{@user.feed.id}\/salmon$/ | ||
profile_rel = "http://salmon-protocol.org/ns/salmon-mention" | ||
profile_uri = @xml.xpath("//xmlns:Link[@rel='#{profile_rel}']") | ||
profile_uri.first.attr("href").must_match regex | ||
end | ||
end | ||
|
||
it "404s if that user doesnt exist" do | ||
get "/users/acct:[email protected]/xrd.xml" | ||
if last_response.status == 301 | ||
|
@@ -25,4 +59,4 @@ | |
|
||
subject.must_equal(param) | ||
end | ||
end | ||
end |