require 'spec_helper'

describe PagesController, "GET to #opensearch", type: :controller do
  context 'when asked for XML file' do
    render_views

    before(:each) do
      get :opensearch, format: 'xml'
    end

    it { should respond_with(:success) }
    it 'renders OpenSearch file successfully' do
      expect(response.body).to include 'Tariff'
    end
  end

  context 'when asked with no format' do
    pending do
      before {
        get :opensearch
      }

      it 'returns HTTP 406 (not supported) status' do
        expect(response.status).to eq 406
      end
    end

    it "raises ActionController::UnknownFormat as per rails 4" do
      expect {
        get :opensearch
      }.to raise_error(ActionController::UnknownFormat)
    end
  end

  context 'with unsupported format' do
    pending do
      before {
        get :opensearch, format: :json
      }

      it 'returns HTTP 406 (not supported) status' do
        expect(response.status).to eq 406
      end
    end

    it "raises ActionController::UnknownFormat as per rails 4" do
      expect {
        get :opensearch, format: :json
      }.to raise_error(ActionController::UnknownFormat)
    end
  end
end

require 'spec_helper'

describe PagesController, "GET to #opensearch", type: :controller do
  context 'when asked for XML file' do
    render_views

    before(:each) do
      get :opensearch, format: 'xml'
    end

    it { should respond_with(:success) }
    it 'renders OpenSearch file successfully' do
      expect(response.body).to include 'Tariff'
    end
  end

  context 'when asked with no format' do
    it "raises ActionController::UnknownFormat as per rails 4" do
      expect {
        get :opensearch
      }.to raise_error(ActionController::UnknownFormat)
    end
  end

  context 'with unsupported format' do
    it "raises ActionController::UnknownFormat as per rails 4" do
      expect {
        get :opensearch, format: :json
      }.to raise_error(ActionController::UnknownFormat)
    end
  end
end

Remove pending specs as Rails 4 raises ActionController::UnknownFormat
Remove pending specs as Rails 4 raises ActionController::UnknownFormat
