diff --git a/app/controllers/admin/university/organizations_controller.rb b/app/controllers/admin/university/organizations_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..87bbb34a243974192a99b4ccc8d153796db41c4b --- /dev/null +++ b/app/controllers/admin/university/organizations_controller.rb @@ -0,0 +1,68 @@ +class Admin::University::OrganizationsController < Admin::University::ApplicationController + load_and_authorize_resource class: University::Organization, + through: :current_university, + through_association: :organizations + + def index + @organizations = @organizations.ordered.page(params[:page]) + breadcrumb + end + + def show + breadcrumb + end + + def new + breadcrumb + end + + def edit + breadcrumb + add_breadcrumb t('edit') + end + + def create + @organization.university = current_university + if @organization.save_and_sync() + redirect_to admin_university_organization_path(@organization), + notice: t('admin.successfully_created_html', model: @organization.to_s) + else + breadcrumb + render :new, status: :unprocessable_entity + end + end + + def update + if @organization.update_and_sync(organization_params) + redirect_to admin_university_organization_path(@organization), + notice: t('admin.successfully_updated_html', model: @organization.to_s) + else + breadcrumb + add_breadcrumb t('edit') + end + end + + def destroy + @organization.destroy_and_sync + redirect_to admin_university_organizations_url, + notice: t('admin.successfully_destroyed_html', model: @organization.to_s) + end + + protected + + def breadcrumb + super + add_breadcrumb University::Organization.model_name.human(count: 2), + admin_university_organizations_path + breadcrumb_for @organization + end + + def organization_params + params.require(:university_organization) + .permit( + :name, :long_name, :description, :active, :sirene, :kind, + :address, :zipcode, :city, :country, + :website, :phone, :mail, :logo, :logo_delete + ) + end +end diff --git a/app/controllers/admin/university/people_controller.rb b/app/controllers/admin/university/people_controller.rb index ad7485c51fc643116329e25820bb32bfba585b13..fa8a15a9ce0bea0cd811bf5075ce9683b0017da8 100644 --- a/app/controllers/admin/university/people_controller.rb +++ b/app/controllers/admin/university/people_controller.rb @@ -25,7 +25,8 @@ class Admin::University::PeopleController < Admin::University::ApplicationContro def create if @person.save_and_sync - redirect_to admin_university_person_path(@person), notice: t('admin.successfully_created_html', model: @person.to_s) + redirect_to admin_university_person_path(@person), + notice: t('admin.successfully_created_html', model: @person.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -34,7 +35,8 @@ class Admin::University::PeopleController < Admin::University::ApplicationContro def update if @person.update_and_sync(person_params) - redirect_to admin_university_person_path(@person), notice: t('admin.successfully_updated_html', model: @person.to_s) + redirect_to admin_university_person_path(@person), + notice: t('admin.successfully_updated_html', model: @person.to_s) else breadcrumb add_breadcrumb t('edit') @@ -44,7 +46,8 @@ class Admin::University::PeopleController < Admin::University::ApplicationContro def destroy @person.destroy_and_sync - redirect_to admin_university_people_url, notice: t('admin.successfully_destroyed_html', model: @person.to_s) + redirect_to admin_university_people_url, + notice: t('admin.successfully_destroyed_html', model: @person.to_s) end protected diff --git a/app/controllers/university/organizations_controller.rb b/app/controllers/university/organizations_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..145babc5c5e8fad9fa248ca8e4ffe68206bac7a0 --- /dev/null +++ b/app/controllers/university/organizations_controller.rb @@ -0,0 +1,11 @@ +class University::OrganizationsController < ApplicationController + load_and_authorize_resource class: University::Organization, + through: :current_university, + through_association: :organizations + + def index + end + + def show + end +end diff --git a/app/models/university.rb b/app/models/university.rb index 7e65310db3239a3b41c53aa39e27fc16439b2a1e..4c1b31dc8af7e5fecc93d8e2057012a6f0ed2709 100644 --- a/app/models/university.rb +++ b/app/models/university.rb @@ -20,7 +20,7 @@ # updated_at :datetime not null # class University < ApplicationRecord - include WithPeople + include WithPeopleAndOrganizations include WithCommunication include WithEducation include WithIdentifier diff --git a/app/models/university/organization.rb b/app/models/university/organization.rb new file mode 100644 index 0000000000000000000000000000000000000000..6adb4785afd7c74c83cb558e43496746cb6d8766 --- /dev/null +++ b/app/models/university/organization.rb @@ -0,0 +1,52 @@ +# == Schema Information +# +# Table name: university_organizations +# +# id :uuid not null, primary key +# active :boolean default(TRUE) +# address :string +# city :string +# country :string +# description :text +# kind :integer default("company") +# long_name :string +# mail :string +# name :string +# phone :string +# sirene :string +# website :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_organizations_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_35fcd198e0 (university_id => universities.id) +# +class University::Organization < ApplicationRecord + include WithGit + include WithBlobs + + has_one_attached_deletable :logo + + belongs_to :university + + scope :ordered, -> { order(:name) } + + validates_presence_of :name + + enum kind: { + company: 10, + non_profit: 20, + government: 30 + } + + def to_s + "#{name}" + end +end diff --git a/app/models/university/with_people.rb b/app/models/university/with_people.rb deleted file mode 100644 index 0f992a60d95bd23246203cd52518556d66e13726..0000000000000000000000000000000000000000 --- a/app/models/university/with_people.rb +++ /dev/null @@ -1,7 +0,0 @@ -module University::WithPeople - extend ActiveSupport::Concern - - included do - has_many :people, class_name: 'University::Person', dependent: :destroy - end -end diff --git a/app/models/university/with_people_and_organizations.rb b/app/models/university/with_people_and_organizations.rb new file mode 100644 index 0000000000000000000000000000000000000000..e9f4c637eb9b7eaaf006831569c8ffb3b0d23ec2 --- /dev/null +++ b/app/models/university/with_people_and_organizations.rb @@ -0,0 +1,8 @@ +module University::WithPeopleAndOrganizations + extend ActiveSupport::Concern + + included do + has_many :people, class_name: 'University::Person', dependent: :destroy + has_many :organizations, class_name: 'University::Organization', dependent: :destroy + end +end diff --git a/app/views/admin/university/organizations/_form.html.erb b/app/views/admin/university/organizations/_form.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..3f4d31f61178e23ce384e07a6a1e94adda56e23c --- /dev/null +++ b/app/views/admin/university/organizations/_form.html.erb @@ -0,0 +1,46 @@ +<%= simple_form_for [:admin, organization] do |f| %> +<div class="row"> + <div class="col-md-6"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('content') %></h5> + </div> + <div class="card-body"> + <%= f.input :name %> + <%= f.input :long_name %> + <%= f.input :kind, include_blank: false %> + <%= f.input :active %> + <%= f.input :sirene %> + <%= f.input :description %> + <%= f.input :logo, + as: :single_deletable_file, + input_html: { accept: '.jpg,.jpeg,.png,.svg' }, + preview: 200, + resize: 1, + direct_upload: true %> + </div> + </div> + </div> + <div class="col-md-6"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"> + <%= University::Organization.human_attribute_name('contact_informations') %> + </h5> + </div> + <div class="card-body"> + <%= f.input :address %> + <%= f.input :zipcode %> + <%= f.input :city %> + <%= f.input :country %> + <%= f.input :website %> + <%= f.input :phone %> + <%= f.input :mail %> + </div> + </div> + </div> +</div> + <% content_for :action_bar_right do %> + <%= submit f %> + <% end %> +<% end %> diff --git a/app/views/admin/university/organizations/_list.html.erb b/app/views/admin/university/organizations/_list.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..6eb06b201203d9039e58356fd683a766985a77fc --- /dev/null +++ b/app/views/admin/university/organizations/_list.html.erb @@ -0,0 +1,23 @@ +<table class="<%= table_classes %>"> + <thead> + <tr> + <th><%= University::Organization.human_attribute_name('name') %></th> + <th><%= University::Organization.human_attribute_name('kind') %></th> + <th></th> + </tr> + </thead> + <tbody> + <% organizations.each do |organization| %> + <tr> + <td><%= link_to organization, admin_university_organization_path(organization) %></td> + <td><%= organization.kind %></td> + <td class="text-end"> + <div class="btn-group" role="group"> + <%= edit_button organization %> + <%= delete_button organization %> + </div> + </td> + </tr> + <% end %> + </tbody> +</table> diff --git a/app/views/admin/university/organizations/edit.html.erb b/app/views/admin/university/organizations/edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..8e990f07344d2b5384fcbe9aaa67cbce7e2000ce --- /dev/null +++ b/app/views/admin/university/organizations/edit.html.erb @@ -0,0 +1,3 @@ +<% content_for :title, @organization %> + +<%= render 'form', organization: @organization %> diff --git a/app/views/admin/university/organizations/index.html.erb b/app/views/admin/university/organizations/index.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..3911980fb6cdd63fa8486c3fc8eed3cea667f72d --- /dev/null +++ b/app/views/admin/university/organizations/index.html.erb @@ -0,0 +1,8 @@ +<% content_for :title, "#{University::Organization.model_name.human(count: 2)} (#{@organizations.total_count})" %> + +<%= render 'admin/university/organizations/list', organizations: @organizations %> +<%= paginate @organizations, theme: 'bootstrap-5' %> + +<% content_for :action_bar_right do %> + <%= create_link University::Organization %> +<% end %> diff --git a/app/views/admin/university/organizations/new.html.erb b/app/views/admin/university/organizations/new.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..96d61c5358d2c3ff3efb5df4fb854c9cbe98b367 --- /dev/null +++ b/app/views/admin/university/organizations/new.html.erb @@ -0,0 +1,3 @@ +<% content_for :title, University::Organization.model_name.human %> + +<%= render 'form', organization: @organization %> diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..f8e7951a39071e3e1acb5d279d146dee403bd3c9 --- /dev/null +++ b/app/views/admin/university/organizations/show.html.erb @@ -0,0 +1,61 @@ +<% content_for :title, @organization %> + +<p> + <strong>Description:</strong> + <%= @organization.description %> +</p> + +<p> + <strong>Address:</strong> + <%= @organization.address %> +</p> + +<p> + <strong>Zipcode:</strong> + <%= @organization.zipcode %> +</p> + +<p> + <strong>City:</strong> + <%= @organization.city %> +</p> + +<p> + <strong>Country:</strong> + <%= @organization.country %> +</p> + +<p> + <strong>Website:</strong> + <%= @organization.website %> +</p> + +<p> + <strong>Phone:</strong> + <%= @organization.phone %> +</p> + +<p> + <strong>Mail:</strong> + <%= @organization.mail %> +</p> + +<p> + <strong>Active:</strong> + <%= @organization.active %> +</p> + +<p> + <strong>Sirene:</strong> + <%= @organization.sirene %> +</p> + +<p> + <strong>Kind:</strong> + <%= @organization.kind %> +</p> + +<% content_for :action_bar_right do %> + <%= edit_link @organization %> + <%= destroy_link @organization %> +<% end %> diff --git a/app/views/admin/university/organizations/static.html.erb b/app/views/admin/university/organizations/static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..71dcdb23744310b9b9e85042e5d4196cd96db55c --- /dev/null +++ b/app/views/admin/university/organizations/static.html.erb @@ -0,0 +1,20 @@ +--- +title: > + <%= @about.to_s %> +long_name: > + <%= @about.long_name %> +kind: "<%= @about.kind %>" +sirene: "<%= @about.sirene %>" +address: "<%= @about.address %>" +zipcode: "<%= @about.zipcode %>" +city: "<%= @about.city %>" +country: "<%= @about.country %>" +phone: "<%= @about.phone %>" +email: "<%= @about.email %>" +website: "<%= @about.website %>" +<% if @about.logo.attached? %> +logo: "<%= @about.logo.blob.id %>" +<% end %> +description: > + <%= prepare_text_for_static @about.description %> +--- diff --git a/config/admin_navigation.rb b/config/admin_navigation.rb index d86963c69e4115854dd51a495f1925826c251f64..9e8ffc691cfc76525fd77d5e3b270cf9ade403e5 100644 --- a/config/admin_navigation.rb +++ b/config/admin_navigation.rb @@ -9,6 +9,7 @@ SimpleNavigation::Configuration.run do |navigation| if can?(:read, User) || can?(:read, University::Person) primary.item :university, University.model_name.human, nil, { kind: :header } primary.item :university, University::Person.model_name.human(count: 2), admin_university_people_path, { icon: 'users-cog' } + primary.item :university, University::Organization.model_name.human(count: 2), admin_university_organizations_path, { icon: 'building' } end if can?(:read, Education::Program) diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index 2d414f1c1a23c3752e19ee151a0775b6116c4e25..de33740634b5a7ecd12a45d737c087c9ee0e6285 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -41,6 +41,9 @@ en: description: Mission (in this context) person: Person target_id: '' + university/organization: + name: Name + long_name: Long name university/role: description: Description (SEO) people: People @@ -54,6 +57,9 @@ en: university/person/involvement: one: Involvement other: Involvements + university/organization: + one: Third party + other: Third parties university/role: one: Role other: Roles diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 6a81eabc7eb6b6ada90e98a0ea7fcba620efb83b..6be4c7d73e2d45ce0809744df58db791a0a2ba1f 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -41,6 +41,9 @@ fr: description: Mission (dans ce contexte) person: Personne target_id: '' + university/organization: + name: Nom + long_name: Nom complet university/role: description: Description (SEO) people: Personnes @@ -54,6 +57,9 @@ fr: university/person/involvement: one: Implication other: Implications + university/organization: + one: Tierce partie + other: Tierces parties university/role: one: Rôle other: Rôles diff --git a/config/routes.rb b/config/routes.rb index f58bf5c2ababb9c7f5d7cfb0c739a2ee06ae48ba..7bf2ee0b0c0d5c65699cb0a2059c705454874c5b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -29,6 +29,8 @@ Rails.application.routes.draw do root to: 'dashboard#index' end + draw 'extranet' + get '/media/:signed_id/:filename_with_transformations' => 'media#show', as: :medium root to: 'home#index' diff --git a/config/routes/admin/university.rb b/config/routes/admin/university.rb index 29714435ac0298bd3b5945b6e8b1d47ce2ac17b1..25328e0bc04d22c54272ccc5bca9318d811c8840 100644 --- a/config/routes/admin/university.rb +++ b/config/routes/admin/university.rb @@ -1,3 +1,3 @@ namespace :university do - resources :people + resources :people, :organizations end diff --git a/config/routes/extranet.rb b/config/routes/extranet.rb new file mode 100644 index 0000000000000000000000000000000000000000..2741f6f22345f343c18789c061acd395dac8d379 --- /dev/null +++ b/config/routes/extranet.rb @@ -0,0 +1,3 @@ +namespace :university do + resources :organizations, only: [:index, :show] +end diff --git a/db/migrate/20220307053000_create_university_organizations.rb b/db/migrate/20220307053000_create_university_organizations.rb new file mode 100644 index 0000000000000000000000000000000000000000..890151d3d7eb913a89e7a70e903cf31f6b377df1 --- /dev/null +++ b/db/migrate/20220307053000_create_university_organizations.rb @@ -0,0 +1,22 @@ +class CreateUniversityOrganizations < ActiveRecord::Migration[6.1] + def change + create_table :university_organizations, id: :uuid do |t| + t.references :university, null: false, foreign_key: true, type: :uuid + t.string :name + t.string :long_name + t.text :description + t.string :address + t.string :zipcode + t.string :city + t.string :country + t.string :website + t.string :phone + t.string :mail + t.boolean :active, default: true + t.string :sirene + t.integer :kind, default: 10 + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 3853ceb6311cd03761f3624ce0cae9fc392cebf0..26287d96df54c851d4e4dba41efa30de68889376 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_03_03_145900) do +ActiveRecord::Schema.define(version: 2022_03_07_053000) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -445,6 +445,23 @@ ActiveRecord::Schema.define(version: 2022_03_03_145900) do t.index ["university_id"], name: "index_education_schools_on_university_id" end + create_table "external_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "title" + t.text "description" + t.string "address" + t.string "zipcode" + t.string "city" + t.string "country" + t.string "website" + t.string "phone" + t.string "mail" + t.boolean "active" + t.string "sirene" + t.integer "kind" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "iso_code" @@ -572,6 +589,26 @@ ActiveRecord::Schema.define(version: 2022_03_03_145900) do t.string "invoice_amount" end + create_table "university_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.uuid "university_id", null: false + t.string "name" + t.string "long_name" + t.text "description" + t.string "address" + t.string "zipcode" + t.string "city" + t.string "country" + t.string "website" + t.string "phone" + t.string "mail" + t.boolean "active", default: true + t.string "sirene" + t.integer "kind", default: 10 + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["university_id"], name: "index_university_organizations_on_university_id" + end + create_table "university_people", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.uuid "user_id" @@ -726,6 +763,7 @@ ActiveRecord::Schema.define(version: 2022_03_03_145900) do add_foreign_key "research_theses", "universities" add_foreign_key "research_theses", "university_people", column: "author_id" add_foreign_key "research_theses", "university_people", column: "director_id" + add_foreign_key "university_organizations", "universities" add_foreign_key "university_people", "universities" add_foreign_key "university_people", "users" add_foreign_key "university_person_involvements", "universities" diff --git a/test/controllers/university/organizations_controller_test.rb b/test/controllers/university/organizations_controller_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..99b5e81e42f0cacf0744db359e753bd9c1ebacc1 --- /dev/null +++ b/test/controllers/university/organizations_controller_test.rb @@ -0,0 +1,48 @@ +require "test_helper" + +class University::OrganizationsControllerTest < ActionDispatch::IntegrationTest + setup do + @university_organization = university_organizations(:one) + end + + test "should get index" do + get university_organizations_url + assert_response :success + end + + test "should get new" do + get new_university_organization_url + assert_response :success + end + + test "should create university_organization" do + assert_difference('University::Organization.count') do + post university_organizations_url, params: { university_organization: { active: @university_organization.active, address: @university_organization.address, city: @university_organization.city, country: @university_organization.country, description: @university_organization.description, kind: @university_organization.kind, mail: @university_organization.mail, phone: @university_organization.phone, sirene: @university_organization.sirene, title: @university_organization.title, website: @university_organization.website, zipcode: @university_organization.zipcode } } + end + + assert_redirected_to university_organization_url(University::Organization.last) + end + + test "should show university_organization" do + get university_organization_url(@university_organization) + assert_response :success + end + + test "should get edit" do + get edit_university_organization_url(@university_organization) + assert_response :success + end + + test "should update university_organization" do + patch university_organization_url(@university_organization), params: { university_organization: { active: @university_organization.active, address: @university_organization.address, city: @university_organization.city, country: @university_organization.country, description: @university_organization.description, kind: @university_organization.kind, mail: @university_organization.mail, phone: @university_organization.phone, sirene: @university_organization.sirene, title: @university_organization.title, website: @university_organization.website, zipcode: @university_organization.zipcode } } + assert_redirected_to university_organization_url(@university_organization) + end + + test "should destroy university_organization" do + assert_difference('University::Organization.count', -1) do + delete university_organization_url(@university_organization) + end + + assert_redirected_to university_organizations_url + end +end diff --git a/test/fixtures/university/organizations.yml b/test/fixtures/university/organizations.yml new file mode 100644 index 0000000000000000000000000000000000000000..fee586714bda1f745e7634535b9258645fc70c2a --- /dev/null +++ b/test/fixtures/university/organizations.yml @@ -0,0 +1,58 @@ +# == Schema Information +# +# Table name: university_organizations +# +# id :uuid not null, primary key +# active :boolean default(TRUE) +# address :string +# city :string +# country :string +# description :text +# kind :integer default("company") +# long_name :string +# mail :string +# name :string +# phone :string +# sirene :string +# website :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_organizations_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_35fcd198e0 (university_id => universities.id) +# + +one: + title: MyString + description: MyText + address: MyString + zipcode: MyString + city: MyString + country: MyString + website: MyString + phone: MyString + mail: MyString + active: false + sirene: MyString + kind: 1 + +two: + title: MyString + description: MyText + address: MyString + zipcode: MyString + city: MyString + country: MyString + website: MyString + phone: MyString + mail: MyString + active: false + sirene: MyString + kind: 1 diff --git a/test/models/university/organization_test.rb b/test/models/university/organization_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..1616f324cb78ad15738915ab65ff206259448ed4 --- /dev/null +++ b/test/models/university/organization_test.rb @@ -0,0 +1,37 @@ +# == Schema Information +# +# Table name: university_organizations +# +# id :uuid not null, primary key +# active :boolean default(TRUE) +# address :string +# city :string +# country :string +# description :text +# kind :integer default("company") +# long_name :string +# mail :string +# name :string +# phone :string +# sirene :string +# website :string +# zipcode :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_university_organizations_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_35fcd198e0 (university_id => universities.id) +# +require "test_helper" + +class University::OrganizationTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/system/university/organizations_test.rb b/test/system/university/organizations_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..1a94a1c5e84ab772b1d7a6b9dee913a5883509fa --- /dev/null +++ b/test/system/university/organizations_test.rb @@ -0,0 +1,65 @@ +require "application_system_test_case" + +class University::OrganizationsTest < ApplicationSystemTestCase + setup do + @university_organization = university_organizations(:one) + end + + test "visiting the index" do + visit university_organizations_url + assert_selector "h1", text: "University/Organizations" + end + + test "creating a Organization" do + visit university_organizations_url + click_on "New University/Organization" + + check "Active" if @university_organization.active + fill_in "Address", with: @university_organization.address + fill_in "City", with: @university_organization.city + fill_in "Country", with: @university_organization.country + fill_in "Description", with: @university_organization.description + fill_in "Kind", with: @university_organization.kind + fill_in "Mail", with: @university_organization.mail + fill_in "Phone", with: @university_organization.phone + fill_in "Sirene", with: @university_organization.sirene + fill_in "Title", with: @university_organization.title + fill_in "Website", with: @university_organization.website + fill_in "Zipcode", with: @university_organization.zipcode + click_on "Create Organization" + + assert_text "Organization was successfully created" + click_on "Back" + end + + test "updating a Organization" do + visit university_organizations_url + click_on "Edit", match: :first + + check "Active" if @university_organization.active + fill_in "Address", with: @university_organization.address + fill_in "City", with: @university_organization.city + fill_in "Country", with: @university_organization.country + fill_in "Description", with: @university_organization.description + fill_in "Kind", with: @university_organization.kind + fill_in "Mail", with: @university_organization.mail + fill_in "Phone", with: @university_organization.phone + fill_in "Sirene", with: @university_organization.sirene + fill_in "Title", with: @university_organization.title + fill_in "Website", with: @university_organization.website + fill_in "Zipcode", with: @university_organization.zipcode + click_on "Update Organization" + + assert_text "Organization was successfully updated" + click_on "Back" + end + + test "destroying a Organization" do + visit university_organizations_url + page.accept_confirm do + click_on "Destroy", match: :first + end + + assert_text "Organization was successfully destroyed" + end +end