Possibility to preview organisations
This commit is contained in:
parent
249714ee10
commit
368301945a
|
@ -4,9 +4,10 @@ class OrgasController < ApplicationController
|
||||||
has_scope :near, type: :hash, using: %i[location distance]
|
has_scope :near, type: :hash, using: %i[location distance]
|
||||||
has_scope :active, type: :boolean, default: true, allow_blank: true
|
has_scope :active, type: :boolean, default: true, allow_blank: true
|
||||||
|
|
||||||
before_action :set_orga, except: %i[index new create]
|
before_action :set_orga, if: -> { params[:id].present? }
|
||||||
before_action :authenticate_user!, except: %i[index new create show],
|
before_action :authenticate_user!, if: -> { params[:id].present? },
|
||||||
unless: :check_secret
|
unless: :check_secret,
|
||||||
|
except: %i[show]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@unfiltered_orgas = apply_scopes(Orga.moderated)
|
@unfiltered_orgas = apply_scopes(Orga.moderated)
|
||||||
|
@ -22,6 +23,13 @@ class OrgasController < ApplicationController
|
||||||
@orga = Orga.new region_id: session[:region]
|
@orga = Orga.new region_id: session[:region]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# POST /orgas/preview
|
||||||
|
def preview_create
|
||||||
|
@orga = Orga.new orga_params
|
||||||
|
@orga.valid?
|
||||||
|
render action: :new
|
||||||
|
end
|
||||||
|
|
||||||
# POST /orgas
|
# POST /orgas
|
||||||
# POST /orgas.json
|
# POST /orgas.json
|
||||||
def create
|
def create
|
||||||
|
@ -42,6 +50,13 @@ class OrgasController < ApplicationController
|
||||||
@events_past = Event.moderated.past.tag @orga.name_as_tag
|
@events_past = Event.moderated.past.tag @orga.name_as_tag
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /orgas/1/preview
|
||||||
|
def preview
|
||||||
|
@orga.attributes = orga_params
|
||||||
|
@orga.valid?
|
||||||
|
render action: :edit
|
||||||
|
end
|
||||||
|
|
||||||
# PATCH/PUT /orgas/1
|
# PATCH/PUT /orgas/1
|
||||||
# PATCH/PUT /orgas/1.json
|
# PATCH/PUT /orgas/1.json
|
||||||
def update
|
def update
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
= f.check_box :active
|
= f.check_box :active
|
||||||
|
|
||||||
.actions
|
.actions
|
||||||
|
= f.button formaction: :preview do
|
||||||
|
%em.fa.fa-eye
|
||||||
|
= t '.visualise'
|
||||||
|
|
||||||
= f.button do
|
= f.button do
|
||||||
%em.fa.fa-check
|
%em.fa.fa-check
|
||||||
= t '.save'
|
= t '.save'
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
%em.fa.fa-users
|
%em.fa.fa-users
|
||||||
= title t '.title'
|
= title t '.title'
|
||||||
|
|
||||||
|
%fieldset
|
||||||
|
%legend
|
||||||
|
%em.fa.fa-eye
|
||||||
|
= t '.preview'
|
||||||
|
= render template: '/orgas/show'
|
||||||
|
|
||||||
%fieldset
|
%fieldset
|
||||||
%legend
|
%legend
|
||||||
%em.fa.fa-edit
|
%em.fa.fa-edit
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
%em.fa.fa-users
|
%em.fa.fa-users
|
||||||
= title t '.title'
|
= title t '.title'
|
||||||
|
|
||||||
|
- if @orga.description
|
||||||
|
%fieldset
|
||||||
|
%legend
|
||||||
|
%em.fa.fa-eye
|
||||||
|
= t '.preview'
|
||||||
|
= render template: '/orgas/show'
|
||||||
|
|
||||||
%fieldset
|
%fieldset
|
||||||
%legend
|
%legend
|
||||||
%em.fa.fa-edit
|
%em.fa.fa-edit
|
||||||
|
|
|
@ -37,7 +37,6 @@ de:
|
||||||
map: Karte
|
map: Karte
|
||||||
show:
|
show:
|
||||||
at: in
|
at: in
|
||||||
dateAndPlace: Datum und Veranstaltungsort
|
|
||||||
noMap: Mit dieser Adresse konnte keine Karte verknüpft werden. Sie können
|
noMap: Mit dieser Adresse konnte keine Karte verknüpft werden. Sie können
|
||||||
andere Syntax hier testen
|
andere Syntax hier testen
|
||||||
infos: Informationen
|
infos: Informationen
|
||||||
|
@ -50,7 +49,6 @@ de:
|
||||||
cancel: Veranstaltung löschen
|
cancel: Veranstaltung löschen
|
||||||
html:
|
html:
|
||||||
at: in
|
at: in
|
||||||
dateAndPlace: Datum und Veranstaltungsort
|
|
||||||
description: Beschreibung
|
description: Beschreibung
|
||||||
infos: Informationen
|
infos: Informationen
|
||||||
new:
|
new:
|
||||||
|
@ -286,6 +284,7 @@ erneut zu übermitteln."
|
||||||
edit: Bearbeiten
|
edit: Bearbeiten
|
||||||
cancel: Löschen
|
cancel: Löschen
|
||||||
show:
|
show:
|
||||||
|
infos: Informationen
|
||||||
future: In kurze Zeit
|
future: In kurze Zeit
|
||||||
past: In der Vergangenheit
|
past: In der Vergangenheit
|
||||||
count:
|
count:
|
||||||
|
@ -294,11 +293,13 @@ erneut zu übermitteln."
|
||||||
other: "%{count} Veranstaltung(en)"
|
other: "%{count} Veranstaltung(en)"
|
||||||
new:
|
new:
|
||||||
title: Organisation
|
title: Organisation
|
||||||
|
preview: Vorschau
|
||||||
edit: Erstellung
|
edit: Erstellung
|
||||||
create:
|
create:
|
||||||
ok: Die Organisation wurde moderiert
|
ok: Die Organisation wurde moderiert
|
||||||
edit:
|
edit:
|
||||||
title: Organisation
|
title: Organisation
|
||||||
|
preview: Vorschau
|
||||||
edit: Bearbeitung
|
edit: Bearbeitung
|
||||||
forbidden: Sie sind nicht berechtigt, diese Organisation zu bearbeiten
|
forbidden: Sie sind nicht berechtigt, diese Organisation zu bearbeiten
|
||||||
update:
|
update:
|
||||||
|
@ -317,8 +318,8 @@ erneut zu übermitteln."
|
||||||
nur vom Absender geändert werden, der einen geheimen verbindlichen Link erhält ...
|
nur vom Absender geändert werden, der einen geheimen verbindlichen Link erhält ...
|
||||||
tags_helper: Durch Leerzeichen getrennt, bestehend aus Buchstaben, Zahlen
|
tags_helper: Durch Leerzeichen getrennt, bestehend aus Buchstaben, Zahlen
|
||||||
und Bindestrichen.
|
und Bindestrichen.
|
||||||
|
|
||||||
save: Speichern
|
save: Speichern
|
||||||
|
visualise: Anzeigen
|
||||||
validate:
|
validate:
|
||||||
title: Bearbeitung der Organisation
|
title: Bearbeitung der Organisation
|
||||||
ok: Ja
|
ok: Ja
|
||||||
|
|
|
@ -37,7 +37,6 @@ en:
|
||||||
map: Map
|
map: Map
|
||||||
show:
|
show:
|
||||||
at: At
|
at: At
|
||||||
dateAndPlace: Date and place
|
|
||||||
noMap: No OpenStreetMap map could be associated to this address. You can
|
noMap: No OpenStreetMap map could be associated to this address. You can
|
||||||
test other syntaxes here
|
test other syntaxes here
|
||||||
infos: Informations
|
infos: Informations
|
||||||
|
@ -50,7 +49,6 @@ en:
|
||||||
cancel: Cancel event
|
cancel: Cancel event
|
||||||
html:
|
html:
|
||||||
at: At
|
at: At
|
||||||
dateAndPlace: Date and place
|
|
||||||
description: Description
|
description: Description
|
||||||
infos: Informations
|
infos: Informations
|
||||||
new:
|
new:
|
||||||
|
@ -109,7 +107,7 @@ it more readable or agreable."
|
||||||
rule_helper: The "Nth day of the month", for example "1st thursday of the
|
rule_helper: The "Nth day of the month", for example "1st thursday of the
|
||||||
month" ou "3rd saturday of the month", is deducted from the very first
|
month" ou "3rd saturday of the month", is deducted from the very first
|
||||||
event
|
event
|
||||||
save: Validate
|
save: Save
|
||||||
visualise: Visualise
|
visualise: Visualise
|
||||||
cancel:
|
cancel:
|
||||||
title: Cancel event
|
title: Cancel event
|
||||||
|
@ -273,6 +271,7 @@ description."
|
||||||
edit: Edit
|
edit: Edit
|
||||||
cancel: Delete
|
cancel: Delete
|
||||||
show:
|
show:
|
||||||
|
infos: Informations
|
||||||
future: Coming
|
future: Coming
|
||||||
past: In the past
|
past: In the past
|
||||||
count:
|
count:
|
||||||
|
@ -281,11 +280,13 @@ description."
|
||||||
other: "%{count} events"
|
other: "%{count} events"
|
||||||
new:
|
new:
|
||||||
title: Organisation
|
title: Organisation
|
||||||
|
preview: Preview
|
||||||
edit: Creation
|
edit: Creation
|
||||||
create:
|
create:
|
||||||
ok: Organisation has been submitted to moderation
|
ok: Organisation has been submitted to moderation
|
||||||
edit:
|
edit:
|
||||||
title: Organisation
|
title: Organisation
|
||||||
|
preview: Preview
|
||||||
edit: Edition
|
edit: Edition
|
||||||
forbidden: You are not authorised to modify this organisation
|
forbidden: You are not authorised to modify this organisation
|
||||||
update:
|
update:
|
||||||
|
@ -305,6 +306,7 @@ description."
|
||||||
will receive a secret edition link...
|
will receive a secret edition link...
|
||||||
tags_helper: Separated with spaces, contain letters, numbers and hyphens
|
tags_helper: Separated with spaces, contain letters, numbers and hyphens
|
||||||
save: Save
|
save: Save
|
||||||
|
visualise: Visualise
|
||||||
validate:
|
validate:
|
||||||
title: Organisation moderation
|
title: Organisation moderation
|
||||||
ok: Yes
|
ok: Yes
|
||||||
|
|
|
@ -37,7 +37,6 @@ fr:
|
||||||
map: Carte
|
map: Carte
|
||||||
show:
|
show:
|
||||||
at: À
|
at: À
|
||||||
dateAndPlace: Date et lieu
|
|
||||||
noMap: Aucune carte n'a pu être associée à cette adresse. Vous pouvez
|
noMap: Aucune carte n'a pu être associée à cette adresse. Vous pouvez
|
||||||
tester d'autres syntaxes ici
|
tester d'autres syntaxes ici
|
||||||
infos: Informations
|
infos: Informations
|
||||||
|
@ -50,7 +49,6 @@ fr:
|
||||||
cancel: Annuler événement
|
cancel: Annuler événement
|
||||||
html:
|
html:
|
||||||
at: À
|
at: À
|
||||||
dateAndPlace: Date et lieu
|
|
||||||
description: Description
|
description: Description
|
||||||
infos: Informations
|
infos: Informations
|
||||||
new:
|
new:
|
||||||
|
@ -124,7 +122,7 @@ procédure à l'aide d'un [script](/adl-submit.py)"
|
||||||
rule_helper: Le "Nème jour du mois", par exemple "1er jeudi du mois" ou
|
rule_helper: Le "Nème jour du mois", par exemple "1er jeudi du mois" ou
|
||||||
"3ème samedi du mois", est déduit à partir du tout premier événement
|
"3ème samedi du mois", est déduit à partir du tout premier événement
|
||||||
save: Valider
|
save: Valider
|
||||||
visualise: Visualiser
|
visualise: Prévisualiser
|
||||||
cancel:
|
cancel:
|
||||||
title: Annulation de l'événement
|
title: Annulation de l'événement
|
||||||
already_moderated: 'Événement déjà modéré: cette annulation le supprimera'
|
already_moderated: 'Événement déjà modéré: cette annulation le supprimera'
|
||||||
|
@ -292,6 +290,7 @@ description plus complète."
|
||||||
edit: Éditer
|
edit: Éditer
|
||||||
cancel: Supprimer
|
cancel: Supprimer
|
||||||
show:
|
show:
|
||||||
|
infos: Informations
|
||||||
future: Prochainement
|
future: Prochainement
|
||||||
past: Dans le passé
|
past: Dans le passé
|
||||||
count:
|
count:
|
||||||
|
@ -300,11 +299,13 @@ description plus complète."
|
||||||
other: "%{count} événements"
|
other: "%{count} événements"
|
||||||
new:
|
new:
|
||||||
title: Organisation
|
title: Organisation
|
||||||
|
preview: Prévisualisation
|
||||||
edit: Création
|
edit: Création
|
||||||
create:
|
create:
|
||||||
ok: L'organisation a été soumise à modération
|
ok: L'organisation a été soumise à modération
|
||||||
edit:
|
edit:
|
||||||
title: Organisation
|
title: Organisation
|
||||||
|
preview: Prévisualisation
|
||||||
edit: Édition
|
edit: Édition
|
||||||
forbidden: Vous n'êtes pas autorisé à modifier cette organisation
|
forbidden: Vous n'êtes pas autorisé à modifier cette organisation
|
||||||
update:
|
update:
|
||||||
|
@ -324,6 +325,7 @@ description plus complète."
|
||||||
tags_helper: Séparés par des espaces, constitués de lettres, chiffres
|
tags_helper: Séparés par des espaces, constitués de lettres, chiffres
|
||||||
et tirets
|
et tirets
|
||||||
save: Envoyer
|
save: Envoyer
|
||||||
|
visualise: Prévisualiser
|
||||||
validate:
|
validate:
|
||||||
title: Modération d'organisation
|
title: Modération d'organisation
|
||||||
ok: Oui
|
ok: Oui
|
||||||
|
|
|
@ -37,7 +37,6 @@ nl:
|
||||||
map: Kaart
|
map: Kaart
|
||||||
show:
|
show:
|
||||||
at: in
|
at: in
|
||||||
dateAndPlace: Datum en evenement plaats
|
|
||||||
noMap: Aan dit adres kan geen kaart gekoppeld worden. Andere syntaxen
|
noMap: Aan dit adres kan geen kaart gekoppeld worden. Andere syntaxen
|
||||||
kunnen hier getestet worden
|
kunnen hier getestet worden
|
||||||
infos: Informatie
|
infos: Informatie
|
||||||
|
@ -50,7 +49,6 @@ nl:
|
||||||
cancel: Evenement verwijderen
|
cancel: Evenement verwijderen
|
||||||
html:
|
html:
|
||||||
at: bij
|
at: bij
|
||||||
dateAndPlace: Datum en plaats
|
|
||||||
description: Beschrijving
|
description: Beschrijving
|
||||||
infos: Informatie
|
infos: Informatie
|
||||||
new:
|
new:
|
||||||
|
@ -288,6 +286,7 @@ vollediger beschrijving."
|
||||||
edit: Bewerken
|
edit: Bewerken
|
||||||
cancel: Verwijderen
|
cancel: Verwijderen
|
||||||
show:
|
show:
|
||||||
|
infos: Informatie
|
||||||
future: Binnenkort
|
future: Binnenkort
|
||||||
past: In het verleden
|
past: In het verleden
|
||||||
count:
|
count:
|
||||||
|
@ -296,11 +295,13 @@ vollediger beschrijving."
|
||||||
other: "%{count} evenementen"
|
other: "%{count} evenementen"
|
||||||
new:
|
new:
|
||||||
title: Organisatie
|
title: Organisatie
|
||||||
|
preview: Voorvertoning
|
||||||
edit: Creatie
|
edit: Creatie
|
||||||
create:
|
create:
|
||||||
ok: Registratie van de organisatie werd onder evaluatie gesteld
|
ok: Registratie van de organisatie werd onder evaluatie gesteld
|
||||||
edit:
|
edit:
|
||||||
title: Organisation
|
title: Organisation
|
||||||
|
preview: Voorvertoning
|
||||||
edit: Bewerken
|
edit: Bewerken
|
||||||
forbidden: U bent niet gemachtigd om deze organisatie te bewerken
|
forbidden: U bent niet gemachtigd om deze organisatie te bewerken
|
||||||
update:
|
update:
|
||||||
|
@ -321,6 +322,7 @@ vollediger beschrijving."
|
||||||
tags_helper: Gescheiden door spaties, bestaande uit letters, cijfers en
|
tags_helper: Gescheiden door spaties, bestaande uit letters, cijfers en
|
||||||
streepjes
|
streepjes
|
||||||
save: Opslaan
|
save: Opslaan
|
||||||
|
visualise: Visualiseren
|
||||||
validate:
|
validate:
|
||||||
title: Evaluatie van organisatie
|
title: Evaluatie van organisatie
|
||||||
ok: Ja
|
ok: Ja
|
||||||
|
|
|
@ -37,7 +37,6 @@ pt-BR:
|
||||||
map: Mapa
|
map: Mapa
|
||||||
show:
|
show:
|
||||||
at: Em
|
at: Em
|
||||||
dateAndPlace: Data e local
|
|
||||||
noMap: Não foi possível associar um mapa no OpenStreetMap a este endereço.
|
noMap: Não foi possível associar um mapa no OpenStreetMap a este endereço.
|
||||||
Você pode testar outras sintaxes aqui
|
Você pode testar outras sintaxes aqui
|
||||||
infos: Informações
|
infos: Informações
|
||||||
|
@ -50,7 +49,6 @@ pt-BR:
|
||||||
cancel: Cancelar evento
|
cancel: Cancelar evento
|
||||||
html:
|
html:
|
||||||
at: Em
|
at: Em
|
||||||
dateAndPlace: Data e local
|
|
||||||
description: Descrição
|
description: Descrição
|
||||||
infos: Informações
|
infos: Informações
|
||||||
new:
|
new:
|
||||||
|
@ -106,7 +104,7 @@ completa, deixando o texto mais legível e agradável.
|
||||||
month" ou "3rd saturday of the month", is deducted from the very first
|
month" ou "3rd saturday of the month", is deducted from the very first
|
||||||
event
|
event
|
||||||
save: Enviar
|
save: Enviar
|
||||||
visualise: Visualizar
|
visualise: Pré-visualização
|
||||||
cancel:
|
cancel:
|
||||||
title: Cancelar o evento
|
title: Cancelar o evento
|
||||||
already_moderated: 'Evento já publicado: este cancelamento irá
|
already_moderated: 'Evento já publicado: este cancelamento irá
|
||||||
|
@ -266,6 +264,7 @@ descrição mais completa."
|
||||||
edit: Editar
|
edit: Editar
|
||||||
cancel: Excluir
|
cancel: Excluir
|
||||||
show:
|
show:
|
||||||
|
infos: Informações
|
||||||
future: A realizar
|
future: A realizar
|
||||||
past: Realizado
|
past: Realizado
|
||||||
count:
|
count:
|
||||||
|
@ -274,11 +273,13 @@ descrição mais completa."
|
||||||
other: "%{count} eventos"
|
other: "%{count} eventos"
|
||||||
new:
|
new:
|
||||||
title: Organização
|
title: Organização
|
||||||
|
preview: Pré-visualização
|
||||||
edit: Criação
|
edit: Criação
|
||||||
create:
|
create:
|
||||||
ok: A organização foi enviada para moderação
|
ok: A organização foi enviada para moderação
|
||||||
edit:
|
edit:
|
||||||
title: Organização
|
title: Organização
|
||||||
|
preview: Prévisualisation
|
||||||
edit: Edição
|
edit: Edição
|
||||||
forbidden: Você não está autorizado a alterar esta organização
|
forbidden: Você não está autorizado a alterar esta organização
|
||||||
update:
|
update:
|
||||||
|
@ -298,6 +299,7 @@ descrição mais completa."
|
||||||
receberá um link secreto para edição.
|
receberá um link secreto para edição.
|
||||||
tags_helper: Separado por espaço, contendo letras, número e hífens
|
tags_helper: Separado por espaço, contendo letras, número e hífens
|
||||||
save: Enviar
|
save: Enviar
|
||||||
|
visualise: Pré-visualização
|
||||||
validate:
|
validate:
|
||||||
title: Confirma a aprovação desta organização?
|
title: Confirma a aprovação desta organização?
|
||||||
ok: Sim
|
ok: Sim
|
||||||
|
|
|
@ -20,6 +20,8 @@ Rails.application.routes.draw do
|
||||||
resources :maps, only: %i[index show]
|
resources :maps, only: %i[index show]
|
||||||
resources :orgas do
|
resources :orgas do
|
||||||
get :cancel, :validate, :refuse, on: :member
|
get :cancel, :validate, :refuse, on: :member
|
||||||
|
post :preview, on: :collection, to: 'orgas#preview_create'
|
||||||
|
patch :preview, on: :member
|
||||||
put :accept, on: :member
|
put :accept, on: :member
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,21 +20,30 @@ class OrgasControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'should preview orga creation' do
|
||||||
|
assert_no_difference 'Orga.count' do
|
||||||
|
post preview_orgas_url, params: { orga: {
|
||||||
|
kind_id: @orga.kind_id, name: @orga.name,
|
||||||
|
city: @orga.city, region_id: @orga.region.id,
|
||||||
|
description: @orga.description,
|
||||||
|
url: @orga.url, contact: @orga.contact, tag_list: 'helo world'
|
||||||
|
} }
|
||||||
|
|
||||||
|
assert_empty assigns(:orga).errors
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
test 'should create orga' do
|
test 'should create orga' do
|
||||||
assert_difference 'Orga.count' do
|
assert_difference 'Orga.count' do
|
||||||
post orgas_url, params: {
|
post orgas_url, params: { orga: {
|
||||||
orga: {
|
kind_id: @orga.kind_id, name: @orga.name,
|
||||||
kind_id: @orga.kind_id,
|
city: @orga.city, region_id: @orga.region.id,
|
||||||
name: @orga.name,
|
description: @orga.description,
|
||||||
city: @orga.city,
|
url: @orga.url, feed: @orga.feed,
|
||||||
region_id: @orga.region.id,
|
contact: @orga.contact, submitter: @orga.contact
|
||||||
description: @orga.description,
|
} }
|
||||||
url: @orga.url,
|
|
||||||
feed: @orga.feed,
|
|
||||||
contact: @orga.contact,
|
|
||||||
submitter: @orga.contact
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_redirected_to assigns(:orga)
|
assert_redirected_to assigns(:orga)
|
||||||
|
@ -42,15 +51,13 @@ class OrgasControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
test 'should create minimalist orga' do
|
test 'should create minimalist orga' do
|
||||||
assert_difference 'Orga.count' do
|
assert_difference 'Orga.count' do
|
||||||
post orgas_url, params: {
|
post orgas_url, params: { orga: {
|
||||||
orga: {
|
kind_id: @orga.kind_id,
|
||||||
kind_id: @orga.kind_id,
|
name: @orga.name,
|
||||||
name: @orga.name,
|
region_id: @orga.region.id,
|
||||||
region_id: @orga.region.id,
|
description: @orga.description,
|
||||||
description: @orga.description,
|
url: @orga.url
|
||||||
url: @orga.url
|
} }
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_redirected_to assigns(:orga)
|
assert_redirected_to assigns(:orga)
|
||||||
|
@ -58,14 +65,12 @@ class OrgasControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
test 'should create orga without content' do
|
test 'should create orga without content' do
|
||||||
assert_difference 'Orga.count' do
|
assert_difference 'Orga.count' do
|
||||||
post orgas_url, params: {
|
post orgas_url, params: { orga: {
|
||||||
orga: {
|
kind_id: @orga.kind_id,
|
||||||
kind_id: @orga.kind_id,
|
name: @orga.name,
|
||||||
name: @orga.name,
|
region_id: @orga.region.id,
|
||||||
region_id: @orga.region.id,
|
url: @orga.url
|
||||||
url: @orga.url
|
} }
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_redirected_to assigns(:orga)
|
assert_redirected_to assigns(:orga)
|
||||||
|
@ -84,6 +89,18 @@ class OrgasControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'should preview' do
|
||||||
|
assert_no_difference 'Orga.count' do
|
||||||
|
patch preview_orga_url(@orga), params: {
|
||||||
|
secret: @orga.secret, orga: { name: @orga.name }
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_empty assigns(:orga).errors
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
test 'should update orga' do
|
test 'should update orga' do
|
||||||
# Necessary to have the proper paper_trail version
|
# Necessary to have the proper paper_trail version
|
||||||
@orga.update name: 'My Title'
|
@orga.update name: 'My Title'
|
||||||
|
@ -97,19 +114,13 @@ class OrgasControllerTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should not update orga' do
|
test 'should not update orga' do
|
||||||
patch orga_url(@orga), params: {
|
patch orga_url(@orga), params: { orga: { name: nil } }
|
||||||
orga: { name: nil }
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_redirected_to :new_user_session
|
assert_redirected_to :new_user_session
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'should not update orga without proper secret' do
|
test 'should not update orga without proper secret' do
|
||||||
patch orga_url(@orga), params: {
|
patch orga_url(@orga), params: { orga: { name: 'hello world' } }
|
||||||
orga: {
|
|
||||||
name: 'hello world'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_redirected_to :new_user_session
|
assert_redirected_to :new_user_session
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue