Sha256: 7205dd307739d9f518ec5faae457b9dea12cdd9c0fde861611d34e0b96837577

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Backend - Page (HTML)", type: :feature do
  describe "show" do
    before { stub_authorization! }

    describe "is available" do
      let(:resource) do
        create(:page, title: "Amazing Page",
                      slug: "amazing",
                      content: "Content of the Page")
      end

      it "finds the Page title" do
        visit "/backend/pages/#{resource.id}"

        expect(page).to have_content("Title: Amazing Page")
      end

      it "finds the Page permalink" do
        visit "/backend/pages/#{resource.id}"

        expect(page).to have_content("Permalink: /amazing")
      end
    end

    describe "is not available" do
      it "returns 404 when it does not exist" do
        visit "/backend/pages/0"

        expect(page)
          .to have_content("Page not found. Could not find what was requested")
      end

      it "returns error message when it is deleted" do
        resource = create(:page, :deleted)

        visit "/backend/pages/#{resource.id}"

        expect(page)
          .to have_content("Page not found. Could not find what was requested")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/features/backend/pages/show_spec.rb