From be8a44e1aa46241790f841952d0507357efbdf20 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Wed, 2 Mar 2022 15:49:39 +0100
Subject: [PATCH] extranets

---
 .../admin/communication/blocks_controller.rb  |  2 +
 .../communication/extranets_controller.rb     | 60 +++++++++++++++++++
 .../administration/qualiopi/indicator.rb      |  2 +-
 app/models/communication/extranet.rb          | 32 ++++++++++
 app/models/communication/website.rb           |  2 +-
 .../communication/website/configs/base_url.rb |  2 +-
 .../website/configs/permalinks.rb             |  2 +-
 app/models/education/program.rb               |  2 +-
 app/models/university/with_communication.rb   |  1 +
 .../communication/extranets/_form.html.erb    | 18 ++++++
 .../communication/extranets/edit.html.erb     |  3 +
 .../communication/extranets/index.html.erb    | 29 +++++++++
 .../communication/extranets/new.html.erb      |  3 +
 .../communication/extranets/show.html.erb     | 10 ++++
 config/admin_navigation.rb                    |  9 +--
 config/locales/communication/en.yml           | 12 +++-
 config/locales/communication/fr.yml           | 12 +++-
 config/routes/admin/communication.rb          |  1 +
 ...02140425_create_communication_extranets.rb | 11 ++++
 db/schema.rb                                  | 12 +++-
 .../extranets_controller_test.rb              | 48 +++++++++++++++
 test/fixtures/communication/extranets.yml     | 29 +++++++++
 test/fixtures/communication/websites.yml      |  2 +-
 test/models/communication/extranet_test.rb    | 26 ++++++++
 test/system/communication/extranets_test.rb   | 47 +++++++++++++++
 25 files changed, 360 insertions(+), 17 deletions(-)
 create mode 100644 app/controllers/admin/communication/extranets_controller.rb
 create mode 100644 app/models/communication/extranet.rb
 create mode 100644 app/views/admin/communication/extranets/_form.html.erb
 create mode 100644 app/views/admin/communication/extranets/edit.html.erb
 create mode 100644 app/views/admin/communication/extranets/index.html.erb
 create mode 100644 app/views/admin/communication/extranets/new.html.erb
 create mode 100644 app/views/admin/communication/extranets/show.html.erb
 create mode 100644 db/migrate/20220302140425_create_communication_extranets.rb
 create mode 100644 test/controllers/communication/extranets_controller_test.rb
 create mode 100644 test/fixtures/communication/extranets.yml
 create mode 100644 test/models/communication/extranet_test.rb
 create mode 100644 test/system/communication/extranets_test.rb

diff --git a/app/controllers/admin/communication/blocks_controller.rb b/app/controllers/admin/communication/blocks_controller.rb
index b0269fa9e..e1dda11bf 100644
--- a/app/controllers/admin/communication/blocks_controller.rb
+++ b/app/controllers/admin/communication/blocks_controller.rb
@@ -29,6 +29,7 @@ class Admin::Communication::BlocksController < Admin::Communication::Application
     if @block.save
       redirect_to [:edit, :admin, @block], notice: t('admin.successfully_created_html', model: @block.to_s)
     else
+      breadcrumb
       render :new, status: :unprocessable_entity
     end
   end
@@ -38,6 +39,7 @@ class Admin::Communication::BlocksController < Admin::Communication::Application
       @block.about.save_and_sync
       redirect_to about_path, notice: t('admin.successfully_updated_html', model: @block.to_s)
     else
+      breadcrumb
       add_breadcrumb t('edit')
       render :edit, status: :unprocessable_entity
     end
diff --git a/app/controllers/admin/communication/extranets_controller.rb b/app/controllers/admin/communication/extranets_controller.rb
new file mode 100644
index 000000000..0329293ca
--- /dev/null
+++ b/app/controllers/admin/communication/extranets_controller.rb
@@ -0,0 +1,60 @@
+class Admin::Communication::ExtranetsController < Admin::Communication::ApplicationController
+  load_and_authorize_resource class: Communication::Extranet,
+                              through: :current_university,
+                              through_association: :communication_extranets
+
+  def index
+    breadcrumb
+  end
+
+  def show
+    breadcrumb
+  end
+
+  def new
+    breadcrumb
+  end
+
+  def edit
+    breadcrumb
+    add_breadcrumb t('edit')
+  end
+
+  def create
+    @extranet.university = current_university
+    if @extranet.save
+      redirect_to [:admin, @extranet], notice: t('admin.successfully_created_html', model: @extranet.to_s)
+    else
+      breadcrumb
+      render :new, status: :unprocessable_entity
+    end
+  end
+
+  def update
+    if @extranet.update(extranet_params)
+      redirect_to [:admin, @extranet], notice: t('admin.successfully_updated_html', model: @extranet.to_s)
+    else
+      breadcrumb
+      add_breadcrumb t('edit')
+      render :edit, status: :unprocessable_entity
+    end
+  end
+
+  def destroy
+    @extranet.destroy
+    redirect_to admin_communication_websites_url, notice: t('admin.successfully_destroyed_html', model: @extranet.to_s)
+  end
+
+  protected
+
+  def breadcrumb
+    super
+    add_breadcrumb Communication::Extranet.model_name.human(count: 2), admin_communication_extranets_path
+    breadcrumb_for @extranet
+  end
+
+  def extranet_params
+    params.require(:communication_extranet)
+          .permit(:name, :domain)
+  end
+end
diff --git a/app/models/administration/qualiopi/indicator.rb b/app/models/administration/qualiopi/indicator.rb
index 300286f22..6e06a0273 100644
--- a/app/models/administration/qualiopi/indicator.rb
+++ b/app/models/administration/qualiopi/indicator.rb
@@ -20,7 +20,7 @@
 #
 # Foreign Keys
 #
-#  fk_rails_31f1a0a2c9  (criterion_id => administration_qualiopi_criterions.id)
+#  fk_rails_eed87f7acf  (criterion_id => administration_qualiopi_criterions.id)
 #
 class Administration::Qualiopi::Indicator < ApplicationRecord
   include Sanitizable
diff --git a/app/models/communication/extranet.rb b/app/models/communication/extranet.rb
new file mode 100644
index 000000000..ee7404ad8
--- /dev/null
+++ b/app/models/communication/extranet.rb
@@ -0,0 +1,32 @@
+# == Schema Information
+#
+# Table name: communication_extranets
+#
+#  id            :uuid             not null, primary key
+#  domain        :string
+#  name          :string
+#  created_at    :datetime         not null
+#  updated_at    :datetime         not null
+#  university_id :uuid             not null, indexed
+#
+# Indexes
+#
+#  index_communication_extranets_on_university_id  (university_id)
+#
+# Foreign Keys
+#
+#  fk_rails_c2268c7ebd  (university_id => universities.id)
+#
+class Communication::Extranet < ApplicationRecord
+  belongs_to :university
+
+  validates_presence_of :name, :domain
+
+  def url
+    "https://#{domain}"
+  end
+
+  def to_s
+    "#{name}"
+  end
+end
diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb
index e4a3519a6..b72ab03ad 100644
--- a/app/models/communication/website.rb
+++ b/app/models/communication/website.rb
@@ -31,7 +31,7 @@
 #
 # Foreign Keys
 #
-#  fk_rails_94b0abd85b  (university_id => universities.id)
+#  fk_rails_bb6a496c08  (university_id => universities.id)
 #
 class Communication::Website < ApplicationRecord
   include WithAbouts
diff --git a/app/models/communication/website/configs/base_url.rb b/app/models/communication/website/configs/base_url.rb
index b016268e4..ffae45935 100644
--- a/app/models/communication/website/configs/base_url.rb
+++ b/app/models/communication/website/configs/base_url.rb
@@ -31,7 +31,7 @@
 #
 # Foreign Keys
 #
-#  fk_rails_94b0abd85b  (university_id => universities.id)
+#  fk_rails_bb6a496c08  (university_id => universities.id)
 #
 class Communication::Website::Configs::BaseUrl < Communication::Website
 
diff --git a/app/models/communication/website/configs/permalinks.rb b/app/models/communication/website/configs/permalinks.rb
index b38d3d26f..0f269522a 100644
--- a/app/models/communication/website/configs/permalinks.rb
+++ b/app/models/communication/website/configs/permalinks.rb
@@ -31,7 +31,7 @@
 #
 # Foreign Keys
 #
-#  fk_rails_94b0abd85b  (university_id => universities.id)
+#  fk_rails_bb6a496c08  (university_id => universities.id)
 #
 class Communication::Website::Configs::Permalinks < Communication::Website
 
diff --git a/app/models/education/program.rb b/app/models/education/program.rb
index 9857f76eb..69cc14e8e 100644
--- a/app/models/education/program.rb
+++ b/app/models/education/program.rb
@@ -39,7 +39,7 @@
 #
 # Foreign Keys
 #
-#  fk_rails_6e16107511  (university_id => universities.id)
+#  fk_rails_08b351087c  (university_id => universities.id)
 #  fk_rails_ec1f16f607  (parent_id => education_programs.id)
 #
 class Education::Program < ApplicationRecord
diff --git a/app/models/university/with_communication.rb b/app/models/university/with_communication.rb
index 01ae9f54b..ccf765d5e 100644
--- a/app/models/university/with_communication.rb
+++ b/app/models/university/with_communication.rb
@@ -2,6 +2,7 @@ module University::WithCommunication
   extend ActiveSupport::Concern
 
   included do
+    has_many :communication_extranets, class_name: 'Communication::Extranet', dependent: :destroy
     has_many :communication_websites, class_name: 'Communication::Website', dependent: :destroy
     has_many :communication_blocks, class_name: 'Communication::Block', dependent: :destroy
   end
diff --git a/app/views/admin/communication/extranets/_form.html.erb b/app/views/admin/communication/extranets/_form.html.erb
new file mode 100644
index 000000000..b4b40af7c
--- /dev/null
+++ b/app/views/admin/communication/extranets/_form.html.erb
@@ -0,0 +1,18 @@
+<%= simple_form_for [:admin, extranet] do |f| %>
+  <div class="row">
+    <div class="col-md-4">
+      <div class="card flex-fill w-100">
+        <div class="card-header">
+          <h5 class="card-title mb-0"><%= t('metadata') %></h5>
+        </div>
+        <div class="card-body">
+          <%= f.input :name %>
+          <%= f.input :domain %>
+        </div>
+      </div>
+    </div>
+  </div>
+  <% content_for :action_bar_right do %>
+    <%= submit f %>
+  <% end %>
+<% end %>
diff --git a/app/views/admin/communication/extranets/edit.html.erb b/app/views/admin/communication/extranets/edit.html.erb
new file mode 100644
index 000000000..150f6bddf
--- /dev/null
+++ b/app/views/admin/communication/extranets/edit.html.erb
@@ -0,0 +1,3 @@
+<% content_for :title, @extranet %>
+
+<%= render 'form', extranet: @extranet %>
diff --git a/app/views/admin/communication/extranets/index.html.erb b/app/views/admin/communication/extranets/index.html.erb
new file mode 100644
index 000000000..94ba71708
--- /dev/null
+++ b/app/views/admin/communication/extranets/index.html.erb
@@ -0,0 +1,29 @@
+<% content_for :title, Communication::Extranet.model_name.human(count: 2) %>
+
+<table class="<%= table_classes %>">
+  <thead>
+    <tr>
+      <th><%= Communication::Website.human_attribute_name('name') %></th>
+      <th><%= Communication::Website.human_attribute_name('url') %></th>
+      <th></th>
+    </tr>
+  </thead>
+  <tbody>
+    <% @extranets.each do |extranet| %>
+      <tr>
+        <td><%= link_to extranet, [:admin, extranet] %></td>
+        <td><%= link_to extranet.url, extranet.url, target: :_blank %></td>
+        <td class="text-end">
+          <div class="btn-group" role="group">
+            <%= edit_link extranet %>
+            <%= destroy_link extranet %>
+          </div>
+        </td>
+      </tr>
+    <% end %>
+  </tbody>
+</table>
+
+<% content_for :action_bar_right do %>
+  <%= create_link Communication::Extranet %>
+<% end %>
diff --git a/app/views/admin/communication/extranets/new.html.erb b/app/views/admin/communication/extranets/new.html.erb
new file mode 100644
index 000000000..31c0c3348
--- /dev/null
+++ b/app/views/admin/communication/extranets/new.html.erb
@@ -0,0 +1,3 @@
+<% content_for :title, Communication::Extranet.model_name.human %>
+
+<%= render 'form', extranet: @extranet %>
diff --git a/app/views/admin/communication/extranets/show.html.erb b/app/views/admin/communication/extranets/show.html.erb
new file mode 100644
index 000000000..c2ce9ea94
--- /dev/null
+++ b/app/views/admin/communication/extranets/show.html.erb
@@ -0,0 +1,10 @@
+<% content_for :title, @extranet %>
+
+<% content_for :title_right do %>
+  <%= link_to @extranet.url, @extranet.url, target: :_blank %>
+<% end unless @extranet.url.blank? %>
+
+<% content_for :action_bar_right do %>
+  <%= edit_link @extranet %>
+  <%= destroy_link @extranet %>
+<% end %>
diff --git a/config/admin_navigation.rb b/config/admin_navigation.rb
index b4d9e9996..9dee7c015 100644
--- a/config/admin_navigation.rb
+++ b/config/admin_navigation.rb
@@ -30,10 +30,11 @@ SimpleNavigation::Configuration.run do |navigation|
     end
 
     if can?(:read, Communication::Website)
-      primary.item :communication, 'Communication', nil, { kind: :header }
-      primary.item :communication_websites, 'Sites Web', admin_communication_websites_path, { icon: 'sitemap' } if can?(:read, Communication::Website)
-      primary.item :communication, 'Lettres d\'information', nil, { icon: 'envelope' }
-      primary.item :communication, 'Alumni', nil, { icon: 'users' }
+      primary.item :communication, Communication.model_name.human, nil, { kind: :header }
+      primary.item :communication_websites, Communication::Website.model_name.human(count: 2), admin_communication_websites_path, { icon: 'sitemap' } if can?(:read, Communication::Website)
+      primary.item :communication_extranets, Communication::Extranet.model_name.human(count: 2), admin_communication_extranets_path, { icon: 'project-diagram' }
+      primary.item :communication_newsletters, 'Lettres d\'information', nil, { icon: 'envelope' }
+      primary.item :communication_alumni, 'Alumni', nil, { icon: 'users' }
     end
 
     if can?(:read, Administration::Qualiopi::Criterion)
diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml
index 177a39aab..b19b79088 100644
--- a/config/locales/communication/en.yml
+++ b/config/locales/communication/en.yml
@@ -7,6 +7,9 @@ en:
       communication/block:
         one: Content block
         other: Content blocks
+      communication/extranet:
+        one: Extranet
+        other: Extranets
       communication/website:
         one: Website
         other: Websites
@@ -36,6 +39,12 @@ en:
         other: Posts
         all: All posts
     attributes:
+      communication/extranet:
+        name: Name
+        domain: Domain
+      communication/block:
+        name: Name
+        template: Kind of block
       communication/website:
         about: About
         about_: Independent website (no specific subject)
@@ -45,9 +54,6 @@ en:
         about_type: About
         name: Name
         url: URL
-      communication/block:
-        name: Name
-        template: Kind of block
       communication/website/category:
         children: Children categories
         description: Description (SEO)
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index 2bce8c491..12410839b 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -7,6 +7,9 @@ fr:
       communication/block:
         one: Bloc de contenu
         other: Blocs de contenu
+      communication/extranet:
+        one: Extranet
+        other: Extranets
       communication/website:
         one: Site Web
         other: Sites Web
@@ -36,6 +39,12 @@ fr:
         other: Actualités
         all: Toutes les actualités
     attributes:
+      communication/block:
+        name: Nom
+        template: Type de bloc
+      communication/extranet:
+        name: Nom
+        domain: Domaine
       communication/website:
         about: Sujet du site
         about_: Site indépendant (aucun sujet)
@@ -45,9 +54,6 @@ fr:
         about_type: Sujet du site
         name: Nom
         url: URL
-      communication/block:
-        name: Nom
-        template: Type de bloc
       communication/website/category:
         children: Catégories enfants
         description: Description (SEO)
diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb
index a0af0b14e..7b07d35b5 100644
--- a/config/routes/admin/communication.rb
+++ b/config/routes/admin/communication.rb
@@ -56,4 +56,5 @@ namespace :communication do
       post :reorder
     end
   end
+  resources :extranets, controller: 'extranets'
 end
diff --git a/db/migrate/20220302140425_create_communication_extranets.rb b/db/migrate/20220302140425_create_communication_extranets.rb
new file mode 100644
index 000000000..c870c65b5
--- /dev/null
+++ b/db/migrate/20220302140425_create_communication_extranets.rb
@@ -0,0 +1,11 @@
+class CreateCommunicationExtranets < ActiveRecord::Migration[6.1]
+  def change
+    create_table :communication_extranets, id: :uuid do |t|
+      t.string :name
+      t.references :university, null: false, foreign_key: true, type: :uuid
+      t.string :domain
+
+      t.timestamps
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 247ea75c5..8afbdb0f0 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2022_02_27_163249) do
+ActiveRecord::Schema.define(version: 2022_03_02_140425) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "pgcrypto"
@@ -93,6 +93,15 @@ ActiveRecord::Schema.define(version: 2022_02_27_163249) do
     t.index ["university_id"], name: "index_communication_blocks_on_university_id"
   end
 
+  create_table "communication_extranets", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
+    t.string "name"
+    t.uuid "university_id", null: false
+    t.string "domain"
+    t.datetime "created_at", precision: 6, null: false
+    t.datetime "updated_at", precision: 6, null: false
+    t.index ["university_id"], name: "index_communication_extranets_on_university_id"
+  end
+
   create_table "communication_website_categories", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
     t.uuid "university_id", null: false
     t.uuid "communication_website_id", null: false
@@ -660,6 +669,7 @@ ActiveRecord::Schema.define(version: 2022_02_27_163249) do
   add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
   add_foreign_key "administration_qualiopi_indicators", "administration_qualiopi_criterions", column: "criterion_id"
   add_foreign_key "communication_blocks", "universities"
+  add_foreign_key "communication_extranets", "universities"
   add_foreign_key "communication_website_categories", "communication_website_categories", column: "parent_id"
   add_foreign_key "communication_website_categories", "communication_websites"
   add_foreign_key "communication_website_categories", "education_programs", column: "program_id"
diff --git a/test/controllers/communication/extranets_controller_test.rb b/test/controllers/communication/extranets_controller_test.rb
new file mode 100644
index 000000000..3e3c20c8b
--- /dev/null
+++ b/test/controllers/communication/extranets_controller_test.rb
@@ -0,0 +1,48 @@
+require "test_helper"
+
+class Communication::ExtranetsControllerTest < ActionDispatch::IntegrationTest
+  setup do
+    @communication_extranet = communication_extranets(:one)
+  end
+
+  test "should get index" do
+    get communication_extranets_url
+    assert_response :success
+  end
+
+  test "should get new" do
+    get new_communication_extranet_url
+    assert_response :success
+  end
+
+  test "should create communication_extranet" do
+    assert_difference('Communication::Extranet.count') do
+      post communication_extranets_url, params: { communication_extranet: { name: @communication_extranet.name, university_id: @communication_extranet.university_id, url: @communication_extranet.url } }
+    end
+
+    assert_redirected_to communication_extranet_url(Communication::Extranet.last)
+  end
+
+  test "should show communication_extranet" do
+    get communication_extranet_url(@communication_extranet)
+    assert_response :success
+  end
+
+  test "should get edit" do
+    get edit_communication_extranet_url(@communication_extranet)
+    assert_response :success
+  end
+
+  test "should update communication_extranet" do
+    patch communication_extranet_url(@communication_extranet), params: { communication_extranet: { name: @communication_extranet.name, university_id: @communication_extranet.university_id, url: @communication_extranet.url } }
+    assert_redirected_to communication_extranet_url(@communication_extranet)
+  end
+
+  test "should destroy communication_extranet" do
+    assert_difference('Communication::Extranet.count', -1) do
+      delete communication_extranet_url(@communication_extranet)
+    end
+
+    assert_redirected_to communication_extranets_url
+  end
+end
diff --git a/test/fixtures/communication/extranets.yml b/test/fixtures/communication/extranets.yml
new file mode 100644
index 000000000..bc8e28dc2
--- /dev/null
+++ b/test/fixtures/communication/extranets.yml
@@ -0,0 +1,29 @@
+# == Schema Information
+#
+# Table name: communication_extranets
+#
+#  id            :uuid             not null, primary key
+#  domain        :string
+#  name          :string
+#  created_at    :datetime         not null
+#  updated_at    :datetime         not null
+#  university_id :uuid             not null, indexed
+#
+# Indexes
+#
+#  index_communication_extranets_on_university_id  (university_id)
+#
+# Foreign Keys
+#
+#  fk_rails_c2268c7ebd  (university_id => universities.id)
+#
+
+one:
+  name: MyString
+  university: one
+  url: MyString
+
+two:
+  name: MyString
+  university: two
+  url: MyString
diff --git a/test/fixtures/communication/websites.yml b/test/fixtures/communication/websites.yml
index d6718e99b..33965b28a 100644
--- a/test/fixtures/communication/websites.yml
+++ b/test/fixtures/communication/websites.yml
@@ -31,7 +31,7 @@
 #
 # Foreign Keys
 #
-#  fk_rails_94b0abd85b  (university_id => universities.id)
+#  fk_rails_bb6a496c08  (university_id => universities.id)
 #
 website_with_github:
   university: default_university
diff --git a/test/models/communication/extranet_test.rb b/test/models/communication/extranet_test.rb
new file mode 100644
index 000000000..6230afc9a
--- /dev/null
+++ b/test/models/communication/extranet_test.rb
@@ -0,0 +1,26 @@
+# == Schema Information
+#
+# Table name: communication_extranets
+#
+#  id            :uuid             not null, primary key
+#  domain        :string
+#  name          :string
+#  created_at    :datetime         not null
+#  updated_at    :datetime         not null
+#  university_id :uuid             not null, indexed
+#
+# Indexes
+#
+#  index_communication_extranets_on_university_id  (university_id)
+#
+# Foreign Keys
+#
+#  fk_rails_c2268c7ebd  (university_id => universities.id)
+#
+require "test_helper"
+
+class Communication::ExtranetTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end
diff --git a/test/system/communication/extranets_test.rb b/test/system/communication/extranets_test.rb
new file mode 100644
index 000000000..ae1fdbd6a
--- /dev/null
+++ b/test/system/communication/extranets_test.rb
@@ -0,0 +1,47 @@
+require "application_system_test_case"
+
+class Communication::ExtranetsTest < ApplicationSystemTestCase
+  setup do
+    @communication_extranet = communication_extranets(:one)
+  end
+
+  test "visiting the index" do
+    visit communication_extranets_url
+    assert_selector "h1", text: "Communication/Extranets"
+  end
+
+  test "creating a Extranet" do
+    visit communication_extranets_url
+    click_on "New Communication/Extranet"
+
+    fill_in "Name", with: @communication_extranet.name
+    fill_in "University", with: @communication_extranet.university_id
+    fill_in "Url", with: @communication_extranet.url
+    click_on "Create Extranet"
+
+    assert_text "Extranet was successfully created"
+    click_on "Back"
+  end
+
+  test "updating a Extranet" do
+    visit communication_extranets_url
+    click_on "Edit", match: :first
+
+    fill_in "Name", with: @communication_extranet.name
+    fill_in "University", with: @communication_extranet.university_id
+    fill_in "Url", with: @communication_extranet.url
+    click_on "Update Extranet"
+
+    assert_text "Extranet was successfully updated"
+    click_on "Back"
+  end
+
+  test "destroying a Extranet" do
+    visit communication_extranets_url
+    page.accept_confirm do
+      click_on "Destroy", match: :first
+    end
+
+    assert_text "Extranet was successfully destroyed"
+  end
+end
-- 
GitLab