Sha256: f735459c9f01686f6a7ffc75b4f6c0cc5227d3e71b3684a07d1d79c13141f533
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require 'spec_helper' module Fizzy module Api describe RenderOverview do let(:dossier_id) { '123' } let(:protocol_subscription_id) { 'abc' } let(:response) { httparty_response('{}') } let(:session) { FactoryGirl.build :basic_auth_session } before do allow(Sessions::BasicAuthSession).to receive(:new).and_return session end it 'should call the correct url' do expect(session).to receive(:get) .with("/dossier/#{dossier_id}/protocol_subscriptions/#{protocol_subscription_id}/render.json") .and_return(response) outcome = described_class.run! dossier_id: dossier_id, protocol_subscription_id: protocol_subscription_id expect(outcome).to eq '{}' end describe 'error handling' do it 'should fail a 500 with an UnexpectedStatusError' do allow(response).to receive(:code).and_return 500 expect(session).to receive(:get) .with("/dossier/#{dossier_id}/protocol_subscriptions/#{protocol_subscription_id}/render.json") .and_return(response) outcome = lambda do described_class.run! dossier_id: dossier_id, protocol_subscription_id: protocol_subscription_id end expect { outcome.call }.to raise_error(Errors::UnexpectedStatusError) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fizzy-api-0.0.6 | spec/fizzy/api/render_overview_spec.rb |
fizzy-api-0.0.5 | spec/fizzy/api/render_overview_spec.rb |