File: response_spec.rb

package info (click to toggle)
ruby-webfinger 2.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: ruby: 401; makefile: 7
file content (45 lines) | stat: -rw-r--r-- 1,071 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'spec_helper'

describe WebFinger::Response do
  let(:_subject_) { 'acct:nov@matake.jp' }
  let(:aliases) { ['mailto:nov@matake.jp'] }
  let(:properties) do
    {'http://webfinger.net/rel/name' => 'Nov Matake'}
  end
  let(:links) do
    [{
      rel: 'http://openid.net/specs/connect/1.0/issuer',
      href: 'https://openid.example.com/'
    }.with_indifferent_access]
  end
  let(:attributes) do
    {
      subject: _subject_,
      aliases: aliases,
      properties: properties,
      links: links
    }.with_indifferent_access
  end
  subject do
    WebFinger::Response.new attributes
  end

  its(:subject)    { should == _subject_ }
  its(:aliases)    { should == aliases }
  its(:properties) { should == properties }
  its(:links)      { should == links }

  describe '#link_for' do
    context 'when unknown' do
      it do
        subject.link_for('unknown').should be_nil
      end
    end

    context 'otherwise' do
      it do
        subject.link_for('http://openid.net/specs/connect/1.0/issuer').should == links.first
      end
    end
  end
end