Sha256: afa3eb16935d749af1f60c8cc534f0cbf161e5be7bbb176ddee98fa47d918610

Contents?: true

Size: 978 Bytes

Versions: 1

Compression:

Stored size: 978 Bytes

Contents

require 'spec_helper'

RSpec.describe Roroacms::PagesController, :type => :controller do

  let!(:record) { FactoryGirl.create(:post, post_type: 'page', post_status: 'Published') }
  let!(:record_draft) { FactoryGirl.create(:post, post_type: 'page', post_status: 'Draft') }

  describe "GET /pages/#id" do

    it "should show any post" do
      get :show, { use_route: :roroacms, id: record_draft.id }
      expect(response.status).to eq(302)
      expect(response).to redirect_to "#{record_draft.structured_url}?admin_preview=true"
    end

  end

  describe "dynamic_page" do

    it "should route to the necessary page" do
      url = record.structured_url[1..-1]
      get :dynamic_page, { use_route: :roroacms, slug: url }
      expect(response.status).to eq(200)
    end

    it "should render 404" do
      url = record_draft.structured_url[1..-1]
      get :dynamic_page, { use_route: :roroacms, slug: url }
      expect(response.status).to eq(404)
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roroacms-0.0.7 spec/controllers/roroacms/pages_controller_spec.rb