summaryrefslogtreecommitdiff
path: root/test/unit/webfinger/host_meta_presenter_test.rb
blob: af86404a7cddc9343a706051da000893dbf3c3de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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