Sha256: b489aefb7b54e6449290e213b4a5f7e2e89087e29321ee589d0bba71fed27f52

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require "rails_helper"

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

    context "when available" do
      before do
        create(:widget, name: "Amazing Widget",
                        slug: "amazing",
                        content: "Content of the Widget")
      end

      it "has the correct Name" do
        visit "/backend/widgets/amazing"

        expect(page).to have_content("Name: Amazing Widget")
      end

      it "has the correct Slug" do
        visit "/backend/widgets/amazing"

        expect(page).to have_content("Slug: amazing")
      end
    end

    context "when not available" do
      it "fails when it does not exist" do
        visit "/backend/widgets/unknown"

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

      it "fails when deleted" do
        create(:widget, :deleted, slug: "deleted-widget")

        visit "/backend/widgets/deleted-widget"

        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/widgets/show_spec.rb