Sha256: b82aa5a1df636e3e3918c99ee7197abcc28e1e489d220eea57a322928c603aad

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

describe SubclassedPagesController do
  render_views

  describe "on GET to /subclassed_pages/also_exists" do
    before { get :show, id: "also_exists" }

    it "responds with success and render template" do
      expect(response).to be_successful
      expect(response).to render_template("also_exists")
    end

    it "uses the custom configured layout" do
      expect(response).not_to render_template("layouts/application")
      expect(response).to render_template("layouts/alternate")
    end
  end

  it 'raises a routing error for an invalid page' do
    expect { get :show, id: "invalid" }.
      to raise_error(ActionController::RoutingError)
  end

  it 'raises a routing error for a page in another directory' do
    expect { get :show, id: "../other/wrong" }.
      to raise_error(ActionController::RoutingError)
  end

  it 'raises a missing template error for valid page with invalid partial' do
    expect { get :show, id: "also_exists_but_references_nonexistent_partial" }.
      to raise_error(ActionView::MissingTemplate)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
high_voltage-3.1.1 spec/controllers/subclassed_pages_controller_spec.rb
high_voltage-3.1.0 spec/controllers/subclassed_pages_controller_spec.rb