Sha256: a589d31b6e13deeb0b21aa67c20a4614f36d19556036f433504b21f2444eba88

Contents?: true

Size: 925 Bytes

Versions: 6

Compression:

Stored size: 925 Bytes

Contents

RSpec.describe Yaks::Resource::Link do
  subject(:link) { described_class.new(rel: rel, uri: uri, options: options) }

  let(:rel)      { :foo_rel }
  let(:uri)      { 'http://api.example.org/rel/foo' }
  let(:options)  { { title: 'mr. spectacular' } }

  its(:rel)     { should eql :foo_rel }
  its(:uri)     { should eql 'http://api.example.org/rel/foo' }
  its(:options) { should eql(title: 'mr. spectacular') }

  its(:title)      { should eql('mr. spectacular') }
  its(:templated?) { should be false }

  context 'with explicit templated option' do
    let(:options) { super().merge(templated: true) }
    its(:templated?) { should be true }
  end

  describe '#rel?' do
    let(:rel) { "/rels/foo" }

    it 'should be true if the rel matches' do
      expect(link.rel?("/rels/foo")).to be true
    end

    it 'should be false if the rel does not match' do
      expect(link.rel?(:foo)).to be false
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
yaks-0.9.0 spec/unit/yaks/resource/link_spec.rb
yaks-0.8.3 spec/unit/yaks/resource/link_spec.rb
yaks-0.8.2 spec/unit/yaks/resource/link_spec.rb
yaks-0.8.1 spec/unit/yaks/resource/link_spec.rb
yaks-0.8.0 spec/unit/yaks/resource/link_spec.rb
yaks-0.8.0.beta2 spec/unit/yaks/resource/link_spec.rb