Sha256: dad7d8f48a70515497561b23eb476d0847eb9a6e6cefef92bef9d907152c5c34
Contents?: true
Size: 1.55 KB
Versions: 4
Compression:
Stored size: 1.55 KB
Contents
require 'spec_helper' require 'pact_broker/api/resources/latest_pact' require 'rack/test' module PactBroker::Api module Resources describe LatestPact do include Rack::Test::Methods let(:app) { PactBroker::API } describe "GET" do context "Accept: text/html" do let(:json_content) { 'json_content' } let(:pact) { double("pact", json_content: json_content)} let(:html) { 'html' } let(:pact_id_params) { {:provider_name=>"provider_name", :consumer_name=>"consumer_name"} } before do allow(PactBroker::Services::PactService).to receive(:find_latest_pact).and_return(pact) allow(PactBroker.configuration.html_pact_renderer).to receive(:call).and_return(html) end subject { get "/pacts/provider/provider_name/consumer/consumer_name/latest",{}, {'HTTP_ACCEPT' => "text/html"} } it "find the pact" do expect(PactBroker::Services::PactService).to receive(:find_latest_pact).with(pact_id_params) subject end it "uses the configured HTML renderer" do expect(PactBroker.configuration.html_pact_renderer).to receive(:call).with(json_content) subject end it "returns a HTML body" do subject expect(last_response.body).to eq html end it "returns a content type of HTML" do subject expect(last_response.headers['Content-Type']).to eq 'text/html' end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems