Sha256: 8def6cb940eee541d725bf88b3ad24084955f77a1f5b0064501322c8ad292271

Contents?: true

Size: 1012 Bytes

Versions: 9

Compression:

Stored size: 1012 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

9 entries across 9 versions & 1 rubygems

Version Path
roroacms-0.0.6.4 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.6.2 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.6.1 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.6 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.5 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.4 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.3 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.2 spec/controllers/roroacms/pages_controller_spec.rb
roroacms-0.0.1 spec/controllers/roroacms/pages_controller_spec.rb