summaryrefslogtreecommitdiff
path: root/users/test/unit
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-01-23 15:52:38 +0100
committerAzul <azul@leap.se>2013-01-23 16:17:51 +0100
commitefb9f511f426b9d6f3af63608e77f80c4b823fb0 (patch)
tree20329dfae6e6182ded56174c2bad21e114ae4583 /users/test/unit
parent30f406de954bac1da5fef7cdd753c0af16f11051 (diff)
added a small test for HostMetaPresenter and using links hash in xml view
Diffstat (limited to 'users/test/unit')
-rw-r--r--users/test/unit/webfinger/.user_presenter_test.rb.swpbin12288 -> 0 bytes
-rw-r--r--users/test/unit/webfinger/host_meta_presenter_test.rb24
2 files changed, 24 insertions, 0 deletions
diff --git a/users/test/unit/webfinger/.user_presenter_test.rb.swp b/users/test/unit/webfinger/.user_presenter_test.rb.swp
deleted file mode 100644
index 5b92867..0000000
--- a/users/test/unit/webfinger/.user_presenter_test.rb.swp
+++ /dev/null
Binary files differ
diff --git a/users/test/unit/webfinger/host_meta_presenter_test.rb b/users/test/unit/webfinger/host_meta_presenter_test.rb
new file mode 100644
index 0000000..af86404
--- /dev/null
+++ b/users/test/unit/webfinger/host_meta_presenter_test.rb
@@ -0,0 +1,24 @@
+require 'test_helper'
+require 'webfinger'
+require 'json'
+
+class Webfinger::HostMetaPresenterTest < ActiveSupport::TestCase
+
+ setup do
+ @request = stub(
+ url: "https://#{APP_CONFIG[:domain]}/.well-known/host-meta"
+ )
+ @meta = Webfinger::HostMetaPresenter.new(@request)
+ end
+
+ test "creates proper json" do
+ hash = JSON.parse @meta.to_json
+ assert_equal ["subject", "links"].sort, hash.keys.sort
+ hash.each do |key, value|
+ assert_equal @meta.send(key.to_sym).to_json, value.to_json
+ end
+ end
+
+end
+
+