Sha256: 671f513419b9e54f9a72938c2d94303d770c566208abe9106155529efd78eace
Contents?: true
Size: 1.33 KB
Versions: 8
Compression:
Stored size: 1.33 KB
Contents
require 'helper/spec_helper' describe SirenClient::Link do let (:link_data) { {"rel"=>["self"],"href"=>"http://example.com/products/03283378000P"} } describe '.new(data)' do it 'raise an error if wrong type is provided' do expect { SirenClient::Link.new([]) }.to raise_error(ArgumentError) end it 'can be instanciated with a hash' do expect(SirenClient::Link.new(link_data)).to be_a SirenClient::Link end end let (:link) { SirenClient::Link.new(link_data) } describe '.go' do it 'follows the link\'s href' do # We just need to know that the link will make the request. expect { link.go }.to raise_error(SirenClient::InvalidResponseError) end end describe '.payload' do it 'is a hash' do expect(link.payload).to be_a Hash end end describe '.rels' do it 'is an array' do expect(link.rels).to be_a Array end end describe '.href' do it 'is a string' do expect(link.href).to be_a String end it 'can change .href as needed' do link.href = link.href + '?query=test' expect(/query=test/).to match(link.href) end end describe '.title' do it 'is a string' do expect(link.title).to be_a String end end describe '.type' do it 'is a string' do expect(link.type).to be_a String end end end
Version data entries
8 entries across 8 versions & 1 rubygems