spec/webfinger/response_spec.rb in webfinger-0.0.2 vs spec/webfinger/response_spec.rb in webfinger-0.0.3
- old
+ new
@@ -1,9 +1,8 @@
require 'spec_helper'
describe WebFinger::Response do
- let(:expires) { 10.minutes.from_now }
let(:_subject_) { 'acct:nov@matake.jp' }
let(:aliases) { ['mailto:nov@matake.jp'] }
let(:properties) do
{'http://webfinger.net/rel/name' => 'Nov Matake'}
end
@@ -13,21 +12,31 @@
href: 'https://openid.example.com/'
}]
end
subject do
WebFinger::Response.new(
- expires: expires,
subject: _subject_,
aliases: aliases,
properties: properties,
links: links
)
end
- its(:expired?) { should be_false }
- its(:expires) { should == expires }
- its(:expires_in) { should == (expires - Time.now).to_i }
- its(:subject) { should == subject }
+ 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
\ No newline at end of file