Sha256: dfcf07c06782979ad6183dc01f0ffe831eb40d7124204003c446a4532c31022d

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require "rails_helper"

RSpec.feature "Pages", type: :feature do
  describe "slug creation" do
    before { stub_authorization! }

    it "can have duplicate slug at different level" do
      foo = create(:page, slug: "foo")
      create(:page, slug: "archangel")

      visit archangel.new_backend_page_path

      fill_in(:page_title, with: "Page Title")
      fill_in(:page_slug, with: "archangel")
      fill_in(:page_content, with: "Page content here.")
      select(foo.title, from: :page_parent_id)

      submit_form

      expect(page).to have_content(
        I18n.t("flash.actions.create.notice", resource_name: "Page")
      )
    end

    it "cannot have duplicate slug at same level" do
      create(:page, slug: "archangel")

      visit archangel.new_backend_page_path

      fill_in(:page_title, with: "Page Title")
      fill_in(:page_slug, with: "archangel")
      fill_in(:page_content, with: "Page content here.")

      submit_form

      expect(page).to have_content "has already been taken"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
archangel-0.3.0 spec/features/backend/pages/duplicate_slugs_spec.rb
archangel-0.0.8 spec/features/backend/pages/duplicate_slugs_spec.rb
archangel-0.0.7 spec/features/backend/duplicate_page_slugs_spec.rb
archangel-0.0.6 spec/features/backend/duplicate_page_slugs_spec.rb
archangel-0.0.5 spec/features/backend/duplicate_page_slugs_spec.rb
archangel-0.0.4 spec/features/backend/duplicate_page_slugs_spec.rb
archangel-0.0.3 spec/features/backend/duplicate_page_slugs_spec.rb
archangel-0.0.2 spec/features/backend/duplicate_page_slugs_spec.rb