Sha256: 4741c6aa53c046de32b4afe8c2d19344d6da6150634e40b58aeb443660b22eec
Contents?: true
Size: 1.2 KB
Versions: 4
Compression:
Stored size: 1.2 KB
Contents
require 'spec_helper' describe Yaks::Mapper::MapLinks do let(:policy) { Class.new(Yaks::DefaultPolicy) { def derive_profile_from_mapper(*); :the_profile ; end }.new } let(:mapper_class) do Class.new(Yaks::Mapper) do def get_title "The Title" end end end subject(:mapper) do mapper_class.new(Object.new, policy: policy) end context 'with a title proc' do before do mapper_class.link :the_link_rel, '/foo/bar', title: ->{ get_title } end it 'should resolve the title' do expect(mapper.map_links).to include Yaks::Resource::Link.new(:the_link_rel, '/foo/bar', title: 'The Title') end end context 'with a title string' do before do mapper_class.link :the_link_rel, '/foo/bar', title: 'fixed string' end it 'should resolve the title' do expect(mapper.map_links).to include Yaks::Resource::Link.new(:the_link_rel, '/foo/bar', title: 'fixed string') end end context 'with no title set' do before do mapper_class.link :the_link_rel, '/foo/bar' end it 'should resolve the title' do expect(mapper.map_links).to include Yaks::Resource::Link.new(:the_link_rel, '/foo/bar', {}) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
yaks-0.3.1 | spec/yaks/mapper/map_links_spec.rb |
yaks-0.3.0 | spec/yaks/mapper/map_links_spec.rb |
yaks-0.2.0 | spec/yaks/mapper/map_links_spec.rb |
yaks-0.1.0 | spec/yaks/mapper/map_links_spec.rb |