Created
April 24, 2015 13:12
-
-
Save plexus/f3db5b609cf02663fd06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Ticketsolve::API::Mappers::ShowMapper do | |
include_context 'with a single show and event' | |
include_context 'yaks context' | |
let(:mapper) { described_class.new(yaks_context) } | |
subject(:resource) { mapper.call(show) } | |
context 'show with no events' do | |
it 'should map attributes' do | |
expect(resource).to match_attributes( | |
id: 7, | |
name: 'A Show', | |
price_description: '', | |
dates: [], | |
description: 'The best ever', | |
sales_disabled: true, | |
sales_disabled_message: nil | |
) | |
end | |
it 'should serialize the the show - links' do | |
expect(resource).to match_links( | |
[ | |
{rel: :self, uri: "/api/shows/7"}, | |
{rel: :profile, uri: 'http://api.ticketsolve.com/profile/show'}, | |
{rel: 'http://api.ticketsolve.com/rel/events', uri: "/api/shows/7/events"} | |
] | |
) | |
end | |
it 'should serialize forms' do | |
expect(resource).to match_forms( | |
promotion_code: { | |
action: "/api/cart/promotion_code", | |
method: 'POST', | |
title: 'promotion_code.title', | |
media_type: 'application/x-www-form-urlencoded', | |
fields: [{name: :code, type: :text, label: 'promotion_code.label', value: ''}] | |
} | |
) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment