+ <% end %>
+<% end %>
diff --git a/app/views/decidim/solutions/solutions/show.html.erb b/app/views/decidim/solutions/solutions/show.html.erb
index 01f5dcd3..f0d752c8 100644
--- a/app/views/decidim/solutions/solutions/show.html.erb
+++ b/app/views/decidim/solutions/solutions/show.html.erb
@@ -1,189 +1,72 @@
-<%= stylesheet_pack_tag "decidim_sdgs" %>
-<%= stylesheet_pack_tag "decidim_solutions" %>
-
-
-
-
-
-
-
-
- <%= resource_reference(current_participatory_space) %>
- <%= render partial: "decidim/shared/share_modal" %>
-
-
-
-
-
- <%= link_to :solutions, class: "small hollow" do %>
- <%= icon "chevron-left", class: "icon--small", role: "img", "aria-hidden": true %>
- <%= t("return_to_list", scope: "decidim.solutions.show") %>
- <% end %>
-
-
-
<%= present(@solution).title %>
-
- <% if current_participatory_space.components.where(manifest_name: "problems").present? && @solution.problem.present? %>
-
<%= t("problem", scope: "activemodel.attributes.solution") %>:
- <%= link_to translated_attribute(@solution.problem.title), Decidim::ResourceLocatorPresenter.new(@solution.problem).path %>
- <%= t("challenge", scope: "activemodel.attributes.problem") %>:
- <%= link_to translated_attribute(@solution.problem.challenge.title), Decidim::ResourceLocatorPresenter.new(@solution.problem.challenge).path %>
- <% else %>
- <%= t("challenge", scope: "activemodel.attributes.solution") %>:
- <%= link_to translated_attribute(@solution.challenge.title), Decidim::ResourceLocatorPresenter.new(@solution.challenge).path %>
- <% end %>
-
-
- <%= t("description", scope: "activemodel.attributes.solution") %>
- <%= present(@solution).description %>
-
- <% if present(@solution).objectives.present? %>
- <%= t("objectives", scope: "activemodel.attributes.solution") %>
- <%= present(@solution).objectives %>
- <% end %>
-
- <% if present(@solution).beneficiaries.present? %>
- <%= t("beneficiaries", scope: "activemodel.attributes.solution") %>
- <%= present(@solution).beneficiaries %>
- <% end %>
-
- <% if present(@solution).requirements.present? %>
- <%= t("requirements", scope: "activemodel.attributes.solution") %>
- <%= present(@solution).requirements %>
- <% end %>
-
- <% if present(@solution).indicators.present? %>
- <%= t("indicators", scope: "activemodel.attributes.solution") %>
- <%= present(@solution).indicators %>
- <% end %>
-
- <% if present(@solution).tags.present? %>
- <%= t("tags", scope: "activemodel.attributes.solution") %>
-
<%= present(@solution).tags %>
- <% end %>
-
- <% if present(@solution).project_url.present? %>
-
<%= t("project_url", scope: "activemodel.attributes.solution") %>
- <%= link_to @solution.project_url, "http://#{@solution.project_url}", target: "_blank" %>
- <% end %>
-
- <% if present(@solution).coordinating_entity.present? %>
-
<%= t("coordinating_entity", scope: "activemodel.attributes.solution") %>
-
<%= present(@solution).coordinating_entity %>
- <% end %>
-
-
+<%= append_stylesheet_pack_tag "decidim_sdgs" %>
+<%= append_stylesheet_pack_tag "decidim_solutions" %>
+
+<%= render layout: "layouts/decidim/shared/layout_item", locals: { back_path: solutions_path } do %>
+
+
+ <%= present(@solution).title(links: true, html_escape: true) %>
+
+
+
+
+ <%= render partial: "decidim/shared/share_modal" %>
+
+ <% if has_problem? %>
+
+ <%= t("problem", scope: "activemodel.attributes.solution") %>:
+ <%= link_to translated_attribute(@solution.problem.title), Decidim::ResourceLocatorPresenter.new(@solution.problem).path %>
+ <%= t("challenge", scope: "activemodel.attributes.problem") %>:
+ <%= link_to translated_attribute(@solution.problem.challenge.title), Decidim::ResourceLocatorPresenter.new(@solution.problem.challenge).path %>
+
+ <% else %>
+
+ <%= t("challenge", scope: "activemodel.attributes.solution") %>:
+ <%= link_to translated_attribute(@solution.challenge.title), Decidim::ResourceLocatorPresenter.new(@solution.challenge).path %>
+
+ <% end %>
+
+ <%= t("description", scope: "activemodel.attributes.solution") %>
+
+
<%= present(@solution).description %>
-
-<%= attachments_for @solution %>
+ <% if present(@solution).objectives.present? %>
+
<%= t("objectives", scope: "activemodel.attributes.solution") %>
+ <%= present(@solution).objectives %>
+ <% end %>
+
+ <% if present(@solution).beneficiaries.present? %>
+
<%= t("beneficiaries", scope: "activemodel.attributes.solution") %>
+ <%= present(@solution).beneficiaries %>
+ <% end %>
+
+ <% if present(@solution).requirements.present? %>
+
<%= t("requirements", scope: "activemodel.attributes.solution") %>
+ <%= present(@solution).requirements %>
+ <% end %>
+
+ <% if present(@solution).indicators.present? %>
+
<%= t("indicators", scope: "activemodel.attributes.solution") %>
+ <%= present(@solution).indicators %>
+ <% end %>
+
+ <% if present(@solution).tags.present? %>
+
<%= t("tags", scope: "activemodel.attributes.solution") %>
+
<%= present(@solution).tags %>
+ <% end %>
+
+ <% if present(@solution).project_url.present? %>
+
<%= t("project_url", scope: "activemodel.attributes.solution") %>
+ <%= link_to @solution.project_url, "http://#{@solution.project_url}", target: "_blank" %>
+ <% end %>
+
+ <% if present(@solution).coordinating_entity.present? %>
+
<%= t("coordinating_entity", scope: "activemodel.attributes.solution") %>
+ <%= present(@solution).coordinating_entity %>
+ <% end %>
+
+
+ <% content_for :aside do %>
+ <%= render partial: "sidebar_data" %>
+ <% end %>
+<% end %>
diff --git a/config/assets.rb b/config/assets.rb
index cd93f21c..9e5f2cae 100644
--- a/config/assets.rb
+++ b/config/assets.rb
@@ -23,4 +23,5 @@
decidim_problems: "#{base_path}/app/packs/entrypoints/decidim_problems.js",
decidim_solutions: "#{base_path}/app/packs/entrypoints/decidim_solutions.js",
decidim_sdgs: "#{base_path}/app/packs/entrypoints/decidim_sdgs.js",
+ decidim_shared: "#{base_path}/app/packs/entrypoints/decidim_shared.js",
)
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index d5f45409..389d9588 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -51,9 +51,16 @@ ca:
tags: Paraules clau
title: Títol
decidim:
+ shared:
+ filters:
+ state: Estat
+ sdgs: SDGs
+ scope: Àmbit
+ related_to: Relacionat amb
challenges:
admin:
actions:
+ title: Accions
configure: Configura
confirm_destroy: Estàs segur que vols destruir aquest %{name}?
destroy: Esborra
@@ -79,6 +86,7 @@ ca:
success: Repte esborrat correctament
edit:
update: Actualitza
+ title: Edita repte
form:
duration: Durada
images: Imatges
@@ -89,6 +97,9 @@ ca:
update:
error: Hi ha hagut un problema actualitzant aquest repte
success: Repte actualitzat correctament
+ index:
+ title: Reptes
+ selected: seleccionat
exports:
answers: Respostes
export_as: "%{name} com a %{export_format}"
@@ -103,8 +114,6 @@ ca:
state: Estat
tags: Paraules clau
title: Títol
- titles:
- challenges_list: Llistat de reptes
surveys:
edit:
save: Desa
@@ -137,7 +146,6 @@ ca:
other: "%{count} reptes"
filters:
all: Totes
- category: Categoria
execution: En execució
finished: Acabada
proposal: Proposta
@@ -145,11 +153,7 @@ ca:
scope: Àmbit
search: Cerca
state: Estat
- filters_small_view:
- close_modal: Tancar finestra
- filter: Filtra
- filter_by: Filtra per
- unfold: Desplega
+ sdgs: SDGs
orders:
label: Ordenacions
random: Aleatori
@@ -1020,6 +1024,9 @@ ca:
error: Hi ha hagut un error despublicant aquest problema
success: Problema despublicat correctament
problems:
+ index:
+ title: Problemas
+ selected: seleccionat
create:
error: Hi ha hagut un error creant aquest problema
success: Problema creat correctament
@@ -1028,6 +1035,7 @@ ca:
has_solutions: No es pot esborrar aquest problema perquè té solucions associades
success: Problema esborrat correctament
edit:
+ title: Edita problema
update: Actualitza
form:
challenge: Repte associat
@@ -1055,7 +1063,6 @@ ca:
other: "%{count} problemes"
filters:
all: Totes
- category: Categoria
execution: En execució
finished: Acabada
proposal: Proposta
@@ -1066,11 +1073,6 @@ ca:
state: Estat
technological_scope: Àmbit tecnològic
territorial_scope: Àmbit territorial
- filters_small_view:
- close_modal: Tancar finestra
- filter: Filtra
- filter_by: Filtra per
- unfold: Desplega
orders:
label: test
random: Aleatori
@@ -1139,6 +1141,8 @@ ca:
error: Hi ha hagut un problema despublicant aquesta solució
success: Solució despublicada correctament
solutions:
+ index:
+ title: Solucions
create:
error: Hi ha hagut un problema creant aquesta solució
success: Solució creada correctament
@@ -1146,6 +1150,7 @@ ca:
error: Hi ha hagut un problema esborrant aquesta solució
success: Solució esborrada correctament
edit:
+ title: Edita solució
update: Actualitza
show:
link: Enllaç
@@ -1190,6 +1195,9 @@ ca:
finished: Finalitzat
index:
new_solution: Nova solució
+ count:
+ one: "%{count} solució"
+ other: "%{count} solucions"
new:
action: Estàs creant una nova solució.
back: Torna
@@ -1210,7 +1218,6 @@ ca:
other: "%{count} solucions"
filters:
all: Totes
- category: Categoria
technical: Tècnics
economic: Econòmics
financial: Finançers
@@ -1219,11 +1226,6 @@ ca:
scope: Àmbit
search: Cerca
territorial_scope: Àmbit territorial
- filters_small_view:
- close_modal: Tancar finestra
- filter: Filtra
- filter_by: Filtra per
- unfold: Desplega
orders:
label: Ordenacions
random: Aleatori
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 78621997..2013802c 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -45,6 +45,10 @@ cs:
tags: Značky
title: Nadpis
decidim:
+ shared:
+ filters:
+ state: State
+ sdgs: SDGs
challenges:
admin:
actions:
@@ -115,7 +119,6 @@ cs:
other: "%{count} výzvy"
filters:
all: Vše
- category: Kategorie
execution: Provedení
finished: Dokončeno
proposal: Návrh
@@ -123,11 +126,6 @@ cs:
scope: Rozsah působnosti
search: Hledat
state: Stav
- filters_small_view:
- close_modal: Zavřít okno
- filter: Filtrovat
- filter_by: Filtrovat podle
- unfold: Rozbalit
orders:
label: test
random: Náhodně
@@ -485,6 +483,9 @@ cs:
error: Při rušení publikování tohoto problému došlo k chybě
success: Zveřejnění problému bylo úspěšně zrušeno
problems:
+ index:
+ title: Problémů
+ selected: vybraný
create:
error: Při vytváření této výzvy došlo k chybě
success: Problém byl úspěšně vytvořen
@@ -493,6 +494,7 @@ cs:
has_solutions: Tento problém nelze odstranit kvůli souvisejícím řešením
success: Problém byl úspěšně smazán
edit:
+ title: Upravit problém
update: Aktualizace
form:
challenge: Související výzva
@@ -520,7 +522,6 @@ cs:
other: "%{count} problémů"
filters:
all: Vše
- category: Kategorie
execution: Provedení
finished: Dokončeno
proposal: Návrh
@@ -531,11 +532,6 @@ cs:
state: State
technological_scope: Technologický rozsah
territorial_scope: Územní rozsah
- filters_small_view:
- close_modal: Zavřít modální okno
- filter: Filtrovat
- filter_by: Filtrovat podle
- unfold: Rozbalit
orders:
label: test
random: Náhodně
@@ -603,6 +599,8 @@ cs:
error: Při zrušení publikování tohoto řešení došlo k problému
success: Řešení bylo správně odebráno publikování
solutions:
+ index:
+ title: řešení
create:
error: Při vytváření tohoto řešení došlo k problému
success: Řešení bylo správně vytvořeno
@@ -610,6 +608,7 @@ cs:
error: Při mazání tohoto řešení došlo k problému
success: Řešení bylo úspěšně odstraněno
edit:
+ title: Upravit řešení
update: Aktualizace
form:
problem: související problém
@@ -638,9 +637,12 @@ cs:
solutions_count:
one: "%{count} řešení"
other: "%{count} řešení"
+ index:
+ count:
+ one: "%{count} řešení"
+ other: "%{count} řešení"
filters:
all: Vše
- category: Kategorie
technical: Technické
economic: Ekonomické
financial: Finanční
@@ -649,11 +651,6 @@ cs:
scope: Rozsah působnosti
search: Hledat
territorial_scope: Územní rozsah působnosti
- filters_small_view:
- close_modal: Zavřít modální okno
- filter: Filtrovat
- filter_by: Filtrovat podle
- unfold: Rozbalit
orders:
label: Seřadit
random: Náhodně
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9305b99f..8c658ed9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -50,9 +50,16 @@ en:
tags: Keywords
title: Title
decidim:
+ shared:
+ filters:
+ state: State
+ sdgs: SDGs
+ scope: Scope
+ related_to: Related to
challenges:
admin:
actions:
+ title: Actions
configure: Configure
confirm_destroy: Are you sure you want to delete this %{name}?
destroy: Delete
@@ -71,6 +78,7 @@ en:
success: Challenge successfully deleted
edit:
update: Update
+ title: Edit challenge
form:
duration: Duration
images: Images
@@ -81,6 +89,9 @@ en:
update:
error: There's been a problem updating this challenge
success: Challenge successfully updated
+ index:
+ title: Challenges
+ selected: selected
challenge_publications:
create:
error: There's been a problem publishing this challenge
@@ -102,8 +113,6 @@ en:
state: State
tags: Tags
title: Title
- titles:
- challenges_list: Challenges list
surveys:
edit:
save: Save
@@ -134,9 +143,12 @@ en:
challenges_count:
one: "%{count} challenge"
other: "%{count} challenges"
+ index:
+ count:
+ one: "%{count} challenge"
+ other: "%{count} challenges"
filters:
all: All
- category: Category
execution: Execution
finished: Finished
proposal: Proposal
@@ -144,11 +156,6 @@ en:
scope: Scope
search: Search
state: State
- filters_small_view:
- close_modal: Close window
- filter: Filter
- filter_by: Filter by
- unfold: Unfold
orders:
label: test
random: Random
@@ -1019,6 +1026,9 @@ en:
error: There's been an error unpublishing this problem
success: Problem successfully unpublished
problems:
+ index:
+ title: Problems
+ selected: selected
create:
error: There's been an error creating this challenge
success: Problem successfully created
@@ -1027,6 +1037,7 @@ en:
has_solutions: This problem couldn't be deleted due to related solutions
success: Problem successfully deleted
edit:
+ title: Edit problem
update: Update
form:
challenge: Related challenge
@@ -1054,7 +1065,6 @@ en:
other: "%{count} problems"
filters:
all: All
- category: Category
execution: Execution
finished: Finished
proposal: Proposal
@@ -1065,11 +1075,6 @@ en:
state: State
technological_scope: Technological scope
territorial_scope: Territorial scope
- filters_small_view:
- close_modal: Close modal
- filter: Filter
- filter_by: Filter by
- unfold: Unfold
orders:
label: test
random: Random
@@ -1138,6 +1143,8 @@ en:
error: There's been a problem unpublising this solution
success: The solution has been correctly unpublished
solutions:
+ index:
+ title: Solucions
create:
error: There's been a problem creating this solution
success: The solution has been correctly created
@@ -1145,6 +1152,7 @@ en:
error: There's been a problem deleting this solution
success: Solution deleted successfully
edit:
+ title: Edit solution
update: Update
show:
link: Link
@@ -1189,6 +1197,9 @@ en:
finished: Finished
index:
new_solution: New solution
+ count:
+ one: "%{count} solution"
+ other: "%{count} solutions"
new:
action: You are creating a new solution
back: Back
@@ -1208,7 +1219,6 @@ en:
other: "%{count} solutions"
filters:
all: All
- category: Category
technical: Technical
economic: Economic
financial: Financial
@@ -1217,11 +1227,6 @@ en:
scope: Scope
search: Search
territorial_scope: Territorial scope
- filters_small_view:
- close_modal: Close window
- filter: Filter
- filter_by: Filter by
- unfold: Unfold
orders:
label: Sorts
random: Random
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 9d21dea4..5e565a3e 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -50,9 +50,14 @@ es:
tags: Palabras clave
title: Titulo
decidim:
+ shared:
+ filters:
+ state: Estado
+ sdgs: SDGs
challenges:
admin:
actions:
+ title: Acciones
configure: Configura
confirm_destroy: Estás seguro de querer destruir este %{name}?
destroy: Borra
@@ -78,6 +83,7 @@ es:
success: Reto borrado correctamente
edit:
update: Actualiza
+ title: Editar reto
form:
duration: Durada
images: Imágenes
@@ -88,6 +94,9 @@ es:
update:
error: Ha habido un problema actualizando este reto
success: Reto actualizado correctamente
+ index:
+ title: Retos
+ selected: seleccionado
exports:
answers: Respuestas
export_as: "%{name} en %{export_format}"
@@ -102,8 +111,6 @@ es:
state: Estado
tags: Palabras clave
title: Titulo
- titles:
- challenges_list: Listado de retos
surveys:
edit:
save: Guarda
@@ -136,7 +143,6 @@ es:
other: "%{count} retos"
filters:
all: Todas
- category: Categoría
execution: En ejecución
finished: Acabada
proposal: Propuesta
@@ -144,11 +150,6 @@ es:
scope: Ámbito
search: Búsqueda
state: Estado
- filters_small_view:
- close_modal: Cerrar ventana
- filter: Filtra
- filter_by: Filtrar por
- unfold: Despliega
orders:
label: Ordenaciones
random: Aleatorio
@@ -1029,6 +1030,9 @@ es:
error: Ha habido un problema despublicando este problema
success: Problema despublicado correctamente
problems:
+ index:
+ title: Problemas
+ selected: seleccionado
create:
error: Ha habido un problema creando este problema
success: Problema creado correctamente
@@ -1037,6 +1041,7 @@ es:
has_solutions: Este problema no se ha podido borrar porqué tiene soluciones asociadas
success: Problema borrado correctamente
edit:
+ title: Editar problema
update: Actualiza
form:
challenge: Reto asociado
@@ -1065,7 +1070,6 @@ es:
other: "%{count} problemas"
filters:
all: Todas
- category: Categoria
execution: En ejecución
finished: Acabada
proposal: Propuesta
@@ -1076,11 +1080,6 @@ es:
state: Estado
technological_scope: Ámbito tecnológico
territorial_scope: Ámbito territorial
- filters_small_view:
- close_modal: Cerrar ventana
- filter: Filtrar
- filter_by: Filtrar por
- unfold: Despliega
orders:
label: test
random: Aleatorio
@@ -1149,6 +1148,8 @@ es:
error: Ha habido un problema despublicando esta solución
success: Solución despublicada correctamente
solutions:
+ index:
+ title: Soluciones
create:
error: Ha habido un problema creando esta solución
success: Solución creada correctamente
@@ -1156,6 +1157,7 @@ es:
error: Ha habido un problema borrando esta solución
success: Solución borrada correctamente
edit:
+ title: Editar solución
update: Actualiza
show:
link: Enlace
@@ -1200,6 +1202,9 @@ es:
finished: Finalizado
index:
new_solution: Nueva solución
+ count:
+ one: "%{count} solución"
+ other: "%{count} soluciones"
new:
action: Estas creando una nueva solución.
back: Atrás
@@ -1219,7 +1224,6 @@ es:
other: "%{count} soluciones"
filters:
all: Todas
- category: Categoria
technical: Técnicos
economic: Económicos
financial: Financieros
@@ -1228,11 +1232,6 @@ es:
scope: Ámbito
search: Búsqueda
territorial_scope: Ámbito territorial
- filters_small_view:
- close_modal: Cerrar ventana
- filter: Filtra
- filter_by: Filtra por
- unfold: Despliega
orders:
label: Ordenaciones
random: Aleatorio
diff --git a/config/locales/oc.yml b/config/locales/oc.yml
index 6a63a478..656b3e21 100644
--- a/config/locales/oc.yml
+++ b/config/locales/oc.yml
@@ -51,9 +51,14 @@ oc:
tags: Paraules clau
title: Títol
decidim:
+ shared:
+ filters:
+ state: Estat
+ sdgs: SDGs
challenges:
admin:
actions:
+ title: Accions
configure: Configura
confirm_destroy: Estàs segur que vols destruir aquest %{name}?
destroy: Esborra
@@ -79,6 +84,7 @@ oc:
success: Repte esborrat correctament
edit:
update: Actualitza
+ title: Edita repte
form:
duration: Durada
images: Imatges
@@ -89,6 +95,8 @@ oc:
update:
error: Hi ha hagut un problema actualitzant aquest repte
success: Repte actualitzat correctament
+ index:
+ title: Reptes
exports:
answers: Respostes
export_as: "%{name} com a %{export_format}"
@@ -103,8 +111,6 @@ oc:
state: Estat
tags: Paraules clau
title: Títol
- titles:
- challenges_list: Llistat de reptes
surveys:
edit:
save: Desa
@@ -137,7 +143,6 @@ oc:
other: "%{count} reptes"
filters:
all: Totes
- category: Categoria
execution: En execució
finished: Acabada
proposal: Proposta
@@ -145,11 +150,6 @@ oc:
scope: Àmbit
search: Cerca
state: Estat
- filters_small_view:
- close_modal: Tancar finestra
- filter: Filtra
- filter_by: Filtra per
- unfold: Desplega
orders:
label: Ordenacions
random: Aleatori
@@ -1055,7 +1055,6 @@ oc:
other: "%{count} problemes"
filters:
all: Totes
- category: Categoria
execution: En execució
finished: Acabada
proposal: Proposta
@@ -1066,11 +1065,6 @@ oc:
state: Estat
technological_scope: Àmbit tecnològic
territorial_scope: Àmbit territorial
- filters_small_view:
- close_modal: Tancar finestra
- filter: Filtra
- filter_by: Filtra per
- unfold: Desplega
orders:
label: test
random: Aleatori
@@ -1209,7 +1203,6 @@ oc:
other: "%{count} solucions"
filters:
all: Totes
- category: Categoria
technical: Tècnics
economic: Econòmics
financial: Finançers
@@ -1218,11 +1211,6 @@ oc:
scope: Àmbit
search: Cerca
territorial_scope: Àmbit territorial
- filters_small_view:
- close_modal: Tancar finestra
- filter: Filtra
- filter_by: Filtra per
- unfold: Desplega
orders:
label: Ordenacions
random: Aleatori
diff --git a/decidim-challenges.gemspec b/decidim-challenges.gemspec
index f0040eba..3fcce708 100644
--- a/decidim-challenges.gemspec
+++ b/decidim-challenges.gemspec
@@ -10,14 +10,13 @@ Gem::Specification.new do |s|
s.email = ["199462+tramuntanal@users.noreply.github.com"]
s.license = "AGPL-3.0"
s.homepage = "https://github.com/decidim/decidim-module-challenges"
- s.required_ruby_version = ">= 3.0.6"
+ s.required_ruby_version = ">= 3.1.1"
s.name = "decidim-challenges"
s.summary = "A decidim challenges module"
s.description = "Articulates the collective action of diverse actors in order to address shared challenges and the problems that derive from them across the territory."
s.files = Dir["{app,config,db,lib}/**/*", "LICENSE-AGPLv3.txt", "Rakefile", "README.md"]
- s.test_files = Dir["spec/**/*"]
s.add_dependency "decidim-core", Decidim::Challenges.decidim_version
diff --git a/lib/decidim/challenges/test/factories.rb b/lib/decidim/challenges/test/factories.rb
index 578d7417..ccd6dd86 100644
--- a/lib/decidim/challenges/test/factories.rb
+++ b/lib/decidim/challenges/test/factories.rb
@@ -6,7 +6,7 @@
factory :challenges_component, parent: :component do
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :challenges).i18n_name }
manifest_name { :challenges }
- participatory_space { create(:participatory_process, :with_steps) }
+ participatory_space { association(:participatory_process, :with_steps) }
trait :with_card_image_allowed do
settings do
@@ -25,11 +25,11 @@
state { "execution" }
start_date { 1.day.from_now }
end_date { start_date + 2.months }
- component { build(:challenges_component) }
+ component { association(:challenges_component) }
coordinating_entities { [1..5].collect { generate(:name) }.join(", ") }
collaborating_entities { [1..5].collect { generate(:name) }.join(", ") }
published_at { Time.current }
- questionnaire { build(:questionnaire) }
+ questionnaire { association(:questionnaire) }
trait :proposal do
state { 0 }
diff --git a/lib/decidim/problems/test/factories.rb b/lib/decidim/problems/test/factories.rb
index 6e2c3384..15782892 100644
--- a/lib/decidim/problems/test/factories.rb
+++ b/lib/decidim/problems/test/factories.rb
@@ -6,7 +6,7 @@
factory :problems_component, parent: :component do
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :problems).i18n_name }
manifest_name { :problems }
- participatory_space { create(:participatory_process, :with_steps) }
+ participatory_space { association(:participatory_process, :with_steps) }
end
factory :problem, traits: [:proposal, :execution, :finished], class: "Decidim::Problems::Problem" do
@@ -18,8 +18,8 @@
groups_affected { "groups affected" }
start_date { 1.day.from_now }
end_date { start_date + 2.months }
- component { build(:component, manifest_name: "problems") }
- challenge { build(:challenge) }
+ component { association(:component, manifest_name: "problems") }
+ challenge { association(:challenge) }
proposing_entities { [1..5].collect { generate(:name) }.join(", ") }
collaborating_entities { [1..5].collect { generate(:name) }.join(", ") }
published_at { Time.current }
diff --git a/lib/decidim/sdgs/test/factories.rb b/lib/decidim/sdgs/test/factories.rb
index 1456ed4b..ffa00d7f 100644
--- a/lib/decidim/sdgs/test/factories.rb
+++ b/lib/decidim/sdgs/test/factories.rb
@@ -6,7 +6,7 @@
factory :sdgs_component, parent: :component do
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :sdgs).i18n_name }
manifest_name { :sdgs }
- participatory_space { create(:participatory_process, :with_steps) }
+ participatory_space { association(:participatory_process, :with_steps) }
end
# Add engine factories here
diff --git a/lib/decidim/solutions/test/factories.rb b/lib/decidim/solutions/test/factories.rb
index 1d14b975..f23013ae 100644
--- a/lib/decidim/solutions/test/factories.rb
+++ b/lib/decidim/solutions/test/factories.rb
@@ -6,16 +6,16 @@
factory :solutions_component, parent: :component do
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :solutions).i18n_name }
manifest_name { :solutions }
- participatory_space { create(:participatory_process, :with_steps) }
+ participatory_space { association(:participatory_process, :with_steps) }
end
factory :solution, class: "Decidim::Solutions::Solution" do
title { generate_localized_title }
description { Decidim::Faker::Localized.wrapped("
", "
") { generate_localized_title } }
- component { build(:solutions_component) }
- author { build(:user, :admin) }
- problem { build(:problem) }
- challenge { build(:challenge) }
+ component { association(:solutions_component) }
+ author { association(:user, :admin) }
+ problem { association(:problem) }
+ challenge { association(:challenge) }
tags { Decidim::Faker::Localized.localized { [1..5].collect { generate(:name) }.join(", ") } }
indicators { Decidim::Faker::Localized.wrapped("
", "
") { generate_localized_title } }
diff --git a/spec/cells/decidim/challenges/challenge_cell_spec.rb b/spec/cells/decidim/challenges/challenge_cell_spec.rb
index f6cf9b39..5fc9e672 100644
--- a/spec/cells/decidim/challenges/challenge_cell_spec.rb
+++ b/spec/cells/decidim/challenges/challenge_cell_spec.rb
@@ -10,16 +10,16 @@ module Decidim::Challenges
Decidim::Faker::Localized.sentence
end
- let!(:challenge) { create :challenge, global_description: description }
+ let!(:challenge) { create(:challenge, global_description: description) }
let!(:challenge_title) { translated(challenge.title) }
- let(:html) { cell("decidim/challenges/challenge", challenge, context: { show_space: show_space }).call }
+ let(:html) { cell("decidim/challenges/challenge", challenge, context: { show_space: }).call }
let!(:challenge_description) { translated(challenge.global_description) }
context "when rendering" do
let(:show_space) { false }
it "renders the card" do
- expect(html).to have_css(".card--challenge")
+ expect(html).to have_css(".card__list")
end
it "renders the challenge description" do
diff --git a/spec/cells/decidim/challenges/challenge_m_cell_spec.rb b/spec/cells/decidim/challenges/challenge_g_cell_spec.rb
similarity index 74%
rename from spec/cells/decidim/challenges/challenge_m_cell_spec.rb
rename to spec/cells/decidim/challenges/challenge_g_cell_spec.rb
index e5b7ab70..d323c4ad 100644
--- a/spec/cells/decidim/challenges/challenge_m_cell_spec.rb
+++ b/spec/cells/decidim/challenges/challenge_g_cell_spec.rb
@@ -11,9 +11,9 @@ module Decidim::Challenges
end
let(:component) { create(:challenges_component, :with_card_image_allowed) }
- let!(:challenge) { create :challenge, :with_card_image, global_description: description, component: component }
+ let!(:challenge) { create(:challenge, :with_card_image, global_description: description, component:) }
let(:model) { challenge }
- let(:cell_html) { cell("decidim/challenges/challenge_m", challenge, context: { show_space: show_space }).call }
+ let(:cell_html) { cell("decidim/challenges/challenge_g", challenge, context: { show_space: }).call }
let!(:challenge_description) { translated(challenge.global_description) }
let!(:challenge_title) { translated(challenge.title) }
@@ -22,7 +22,7 @@ module Decidim::Challenges
let!(:card_image) { create(:attachment, :with_image, attached_to: challenge) }
it "renders the card" do
- expect(cell_html).to have_css(".card--challenge")
+ expect(cell_html).to have_css(".card__list")
end
it "renders the challenge description" do
@@ -34,7 +34,7 @@ module Decidim::Challenges
end
it "renders the challenge image card" do
- expect(cell_html).to have_css(".card__image")
+ expect(cell_html).to have_css(".card__list-image")
end
end
end
diff --git a/spec/cells/decidim/problems/problem_cell_spec.rb b/spec/cells/decidim/problems/problem_cell_spec.rb
index 908a851f..62d71d83 100644
--- a/spec/cells/decidim/problems/problem_cell_spec.rb
+++ b/spec/cells/decidim/problems/problem_cell_spec.rb
@@ -9,18 +9,17 @@ module Decidim::Problems
let(:description) do
Decidim::Faker::Localized.sentence
end
- let!(:problem) { create :problem, description: description }
+ let!(:problem) { create(:problem, description:) }
let(:model) { problem }
let!(:problem_title) { translated(problem.title) }
let!(:problem_description) { translated(problem.description) }
- let!(:challenge_title) { translated(problem.challenge.title) }
- let(:html) { cell("decidim/problems/problem", problem, context: { show_space: show_space }).call }
+ let(:html) { cell("decidim/problems/problem", problem, context: { show_space: }).call }
context "when rendering" do
let(:show_space) { false }
it "renders the card" do
- expect(html).to have_css(".card--problem")
+ expect(html).to have_css(".card__list")
end
it "renders the problem title" do
@@ -30,10 +29,6 @@ module Decidim::Problems
it "renders the problem description" do
expect(html).to have_content(problem_description)
end
-
- it "renders the challenge title" do
- expect(html).to have_content(challenge_title)
- end
end
end
end
diff --git a/spec/cells/decidim/problems/problem_m_cell_spec.rb b/spec/cells/decidim/problems/problem_g_cell_spec.rb
similarity index 64%
rename from spec/cells/decidim/problems/problem_m_cell_spec.rb
rename to spec/cells/decidim/problems/problem_g_cell_spec.rb
index 75273869..dccb5812 100644
--- a/spec/cells/decidim/problems/problem_m_cell_spec.rb
+++ b/spec/cells/decidim/problems/problem_g_cell_spec.rb
@@ -9,18 +9,17 @@ module Decidim::Problems
let(:description) do
Decidim::Faker::Localized.sentence
end
- let!(:problem) { create :problem, description: description }
+ let!(:problem) { create(:problem, description:) }
let(:model) { problem }
- let(:cell_html) { cell("decidim/problems/problem_m", problem, context: { show_space: show_space }).call }
+ let(:cell_html) { cell("decidim/problems/problem_g", problem, context: { show_space: }).call }
let!(:problem_title) { translated(problem.title) }
let!(:problem_description) { translated(problem.description) }
- let!(:challenge_title) { translated(problem.challenge.title) }
context "when rendering" do
let(:show_space) { false }
it "renders the card" do
- expect(cell_html).to have_css(".card--problem")
+ expect(cell_html).to have_css(".card__list")
end
it "renders the problem title" do
@@ -30,10 +29,6 @@ module Decidim::Problems
it "renders the problem description" do
expect(cell_html).to have_content(problem_description)
end
-
- it "renders the challenge title" do
- expect(cell_html).to have_content(challenge_title)
- end
end
end
end
diff --git a/spec/cells/decidim/solutions/solution_cell_spec.rb b/spec/cells/decidim/solutions/solution_cell_spec.rb
index c0a38129..2f874860 100644
--- a/spec/cells/decidim/solutions/solution_cell_spec.rb
+++ b/spec/cells/decidim/solutions/solution_cell_spec.rb
@@ -10,18 +10,16 @@ module Decidim::Solutions
Decidim::Faker::Localized.sentence
end
- let!(:solution) { create :solution, description: description }
+ let!(:solution) { create(:solution, description:) }
let!(:solution_title) { translated(solution.title) }
- let(:html) { cell("decidim/solutions/solution", solution, context: { show_space: show_space }).call }
+ let(:html) { cell("decidim/solutions/solution_g", solution, context: { show_space: }).call }
let!(:solution_description) { translated(solution.description) }
- let!(:problem_title) { translated(solution.problem.title) }
- let!(:challenge_title) { translated(solution.problem.challenge.title) }
context "when rendering" do
let(:show_space) { false }
it "renders the card" do
- expect(html).to have_css(".card--solution")
+ expect(html).to have_css(".card__list")
end
it "renders the solution description" do
@@ -31,14 +29,6 @@ module Decidim::Solutions
it "renders the solution title" do
expect(html).to have_content(solution_title)
end
-
- it "renders the problem title" do
- expect(html).to have_content(problem_title)
- end
-
- it "renders the challenge title" do
- expect(html).to have_content(challenge_title)
- end
end
end
end
diff --git a/spec/cells/decidim/solutions/solution_g_cell_spec.rb b/spec/cells/decidim/solutions/solution_g_cell_spec.rb
new file mode 100644
index 00000000..890fa933
--- /dev/null
+++ b/spec/cells/decidim/solutions/solution_g_cell_spec.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+require "spec_helper"
+
+module Decidim::Solutions
+ describe SolutionCell, type: :cell do
+ controller Decidim::Solutions::SolutionsController
+
+ let(:description) do
+ Decidim::Faker::Localized.sentence
+ end
+
+ let(:model) { solution }
+ let(:solution_description) { translated(solution.description) }
+ let(:solution_title) { translated(solution.title) }
+ let(:sdg_code) { :sustainable_cities }
+ let(:show_space) { false }
+ let(:cell_html) { cell("decidim/solutions/solution_g", solution, context: { show_space: }).call }
+
+ shared_examples "rendering the cell" do
+ before do
+ challenge.update_columns(sdg_code:)
+ end
+
+ it "renders the card" do
+ expect(cell_html).to have_css(".card__list")
+ expect(cell_html).to have_content(solution_description)
+ expect(cell_html).to have_content(solution_title)
+ expect(cell_html).to have_content(t(sdg_code, scope: "decidim.sdgs.names"))
+ end
+ end
+ end
+end
diff --git a/spec/cells/decidim/solutions/solution_m_cell_spec.rb b/spec/cells/decidim/solutions/solution_m_cell_spec.rb
deleted file mode 100644
index eb1dbf6a..00000000
--- a/spec/cells/decidim/solutions/solution_m_cell_spec.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-# frozen_string_literal: true
-
-require "spec_helper"
-
-module Decidim::Solutions
- describe SolutionCell, type: :cell do
- controller Decidim::Solutions::SolutionsController
-
- let(:description) do
- Decidim::Faker::Localized.sentence
- end
-
- let(:model) { solution }
- let(:solution_description) { translated(solution.description) }
- let(:solution_title) { translated(solution.title) }
- let(:challenge_title) { translated(challenge.title) }
- let(:sdg_code) { :sustainable_cities }
- let(:show_space) { false }
- let(:cell_html) { cell("decidim/solutions/solution_m", solution, context: { show_space: show_space }).call }
-
- shared_examples "rendering the cell" do
- before do
- challenge.update_columns(sdg_code: sdg_code)
- end
-
- it "renders the card" do
- expect(cell_html).to have_css(".card--solution")
- expect(cell_html).to have_content(solution_description)
- expect(cell_html).to have_content(solution_title)
- expect(cell_html).to have_content(challenge_title)
- expect(cell_html).to have_content(t(sdg_code, scope: "decidim.sdgs.names"))
- end
- end
-
- context "when the parent is a problem" do
- let!(:solution) { create :solution, description: description }
- let(:challenge) { solution.problem.challenge }
- let(:problem_title) { translated(solution.problem.title) }
-
- it_behaves_like "rendering the cell"
-
- it "renders the problem title" do
- expect(cell_html).to have_content(problem_title)
- end
- end
-
- context "when the parent is a challenge" do
- let(:challenge) { create :challenge }
- let!(:solution) { create :solution, description: description, problem: nil, challenge: challenge }
-
- it_behaves_like "rendering the cell"
-
- it "renders the challenge title" do
- expect(cell_html).to have_content(translated(challenge.title))
- end
- end
- end
-end
diff --git a/spec/commands/decidim/challenges/admin/create_challenge_spec.rb b/spec/commands/decidim/challenges/admin/create_challenge_spec.rb
index 197946e4..2df45f2e 100644
--- a/spec/commands/decidim/challenges/admin/create_challenge_spec.rb
+++ b/spec/commands/decidim/challenges/admin/create_challenge_spec.rb
@@ -8,11 +8,11 @@ module Admin
describe CreateChallenge do
subject { described_class.new(form) }
- let(:organization) { create :organization, available_locales: [:en] }
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:current_component) { create :component, participatory_space: participatory_process, manifest_name: "challenges" }
- let(:scope) { create :scope, organization: organization }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:current_component) { create(:component, participatory_space: participatory_process, manifest_name: "challenges") }
+ let(:scope) { create(:scope, organization:) }
let(:sdg_code) { "clean_water" }
let(:tags) { "tag1, tag2, tag3" }
let(:state) { 2 }
@@ -28,18 +28,18 @@ module Admin
title: { en: "title" },
local_description: { en: "local desc" },
global_description: { en: "global desc" },
- tags: tags,
- scope: scope,
- sdg_code: sdg_code,
- state: state,
- start_date: start_date,
- end_date: end_date,
- coordinating_entities: coordinating_entities,
- collaborating_entities: collaborating_entities,
- current_user: current_user,
+ tags:,
+ scope:,
+ sdg_code:,
+ state:,
+ start_date:,
+ end_date:,
+ coordinating_entities:,
+ collaborating_entities:,
+ current_user:,
current_organization: organization,
- current_component: current_component,
- card_image: card_image
+ current_component:,
+ card_image:
)
end
let(:invalid) { false }
diff --git a/spec/commands/decidim/challenges/admin/destroy_challenge_spec.rb b/spec/commands/decidim/challenges/admin/destroy_challenge_spec.rb
index 4ce5a6a6..706b9bc5 100644
--- a/spec/commands/decidim/challenges/admin/destroy_challenge_spec.rb
+++ b/spec/commands/decidim/challenges/admin/destroy_challenge_spec.rb
@@ -8,10 +8,10 @@ module Admin
describe DestroyChallenge do
subject { described_class.new(challenge, current_user) }
- let(:my_process) { create :participatory_process }
- let!(:current_user) { create :user, email: "some_email@example.org", organization: my_process.organization }
- let!(:user) { create :user, :confirmed, organization: my_process.organization }
- let(:challenge) { create :challenge }
+ let(:my_process) { create(:participatory_process) }
+ let!(:current_user) { create(:user, email: "some_email@example.org", organization: my_process.organization) }
+ let!(:user) { create(:user, :confirmed, organization: my_process.organization) }
+ let(:challenge) { create(:challenge) }
context "when everything is ok" do
it "deletes the challenge" do
@@ -33,7 +33,7 @@ module Admin
end
context "when has dependent problems" do
- let(:problem) { create :problem, challenge: challenge }
+ let(:problem) { create(:problem, challenge:) }
it "not deletes the challenge" do
expect { subject.call }.not_to change(Decidim::Challenges::Challenge, :count)
diff --git a/spec/commands/decidim/challenges/admin/export_challenge_surveys_spec.rb b/spec/commands/decidim/challenges/admin/export_challenge_surveys_spec.rb
index 1421796e..9befcfc5 100644
--- a/spec/commands/decidim/challenges/admin/export_challenge_surveys_spec.rb
+++ b/spec/commands/decidim/challenges/admin/export_challenge_surveys_spec.rb
@@ -6,9 +6,9 @@ module Decidim::Challenges
describe Admin::ExportChallengeSurveys do
subject { described_class.new(challenge, format, user) }
- let(:challenge) { create :challenge }
+ let(:challenge) { create(:challenge) }
let(:format) { "CSV" }
- let(:user) { create :user, :admin }
+ let(:user) { create(:user, :admin) }
context "when everything is ok" do
it "exports the challenge survey" do
diff --git a/spec/commands/decidim/challenges/admin/update_challenge_spec.rb b/spec/commands/decidim/challenges/admin/update_challenge_spec.rb
index 2fc6d1ee..8d25dfca 100644
--- a/spec/commands/decidim/challenges/admin/update_challenge_spec.rb
+++ b/spec/commands/decidim/challenges/admin/update_challenge_spec.rb
@@ -8,11 +8,11 @@ module Admin
describe UpdateChallenge do
subject { described_class.new(form, challenge) }
- let(:organization) { create :organization, available_locales: [:en] }
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:current_component) { create :component, participatory_space: participatory_process, manifest_name: "challenges" }
- let(:scope) { create :scope, organization: organization }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:current_component) { create(:component, participatory_space: participatory_process, manifest_name: "challenges") }
+ let(:scope) { create(:scope, organization:) }
let(:title) { "title" }
let(:sdg_code) { Sdgs::Sdg::SDGS.first }
let(:tags) { "tag1, tag2, tag3" }
@@ -29,22 +29,22 @@ module Admin
title: { en: title },
local_description: { en: "local desc" },
global_description: { en: "global desc" },
- tags: tags,
- scope: scope,
- sdg_code: sdg_code,
- state: state,
- start_date: start_date,
- end_date: end_date,
- coordinating_entities: coordinating_entities,
- collaborating_entities: collaborating_entities,
- current_user: current_user,
+ tags:,
+ scope:,
+ sdg_code:,
+ state:,
+ start_date:,
+ end_date:,
+ coordinating_entities:,
+ collaborating_entities:,
+ current_user:,
current_organization: organization,
- current_component: current_component,
- card_image: card_image
+ current_component:,
+ card_image:
)
end
let(:invalid) { false }
- let(:challenge) { create :challenge }
+ let(:challenge) { create(:challenge) }
context "when the form is not valid" do
let(:invalid) { true }
diff --git a/spec/commands/decidim/challenges/admin/update_surveys_spec.rb b/spec/commands/decidim/challenges/admin/update_surveys_spec.rb
index 11af3105..887c458b 100644
--- a/spec/commands/decidim/challenges/admin/update_surveys_spec.rb
+++ b/spec/commands/decidim/challenges/admin/update_surveys_spec.rb
@@ -13,7 +13,7 @@ module Decidim::Challenges
let(:form) do
double(
invalid?: invalid,
- survey_enabled: survey_enabled,
+ survey_enabled:,
)
end
diff --git a/spec/commands/decidim/challenges/survey_challenge_spec.rb b/spec/commands/decidim/challenges/survey_challenge_spec.rb
index 0fe200f2..e1cdd067 100644
--- a/spec/commands/decidim/challenges/survey_challenge_spec.rb
+++ b/spec/commands/decidim/challenges/survey_challenge_spec.rb
@@ -6,24 +6,24 @@ module Decidim::Challenges
describe SurveyChallenge do
subject { described_class.new(challenge, user, survey_form) }
- let(:organization) { create :organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:component) { create :component, manifest_name: :challenges, participatory_space: participatory_process }
+ let(:organization) { create(:organization) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:component) { create(:component, manifest_name: :challenges, participatory_space: participatory_process) }
let(:survey_enabled) { true }
let(:challenge) do
create(:challenge,
- component: component,
- survey_enabled: survey_enabled,
- questionnaire: questionnaire)
+ component:,
+ survey_enabled:,
+ questionnaire:)
end
- let(:user) { create :user, :confirmed, organization: organization }
+ let(:user) { create(:user, :confirmed, organization:) }
let!(:questionnaire) { create(:questionnaire) }
- let!(:question) { create(:questionnaire_question, questionnaire: questionnaire) }
+ let!(:question) { create(:questionnaire_question, questionnaire:) }
let(:session_token) { "some-token" }
- let(:survey_form) { Decidim::Forms::QuestionnaireForm.from_model(questionnaire).with_context(session_token: session_token) }
+ let(:survey_form) { Decidim::Forms::QuestionnaireForm.from_model(questionnaire).with_context(session_token:) }
context "when everything is ok" do
context "and the survey form is invalid" do
@@ -61,7 +61,7 @@ module Decidim::Challenges
context "when the user has already answered survey" do
before do
- create(:survey, challenge: challenge, user: user)
+ create(:survey, challenge:, user:)
end
it "broadcasts invalid" do
diff --git a/spec/commands/decidim/problems/admin/create_problem_spec.rb b/spec/commands/decidim/problems/admin/create_problem_spec.rb
index 3db11e91..9b9024d6 100644
--- a/spec/commands/decidim/problems/admin/create_problem_spec.rb
+++ b/spec/commands/decidim/problems/admin/create_problem_spec.rb
@@ -8,13 +8,13 @@ module Admin
describe CreateProblem do
subject { described_class.new(form) }
- let(:organization) { create :organization, available_locales: [:en] }
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:current_component) { create :component, participatory_space: participatory_process, manifest_name: "problems" }
- let(:challenge) { create :challenge }
- let(:sectorial_scope) { create :scope, organization: organization }
- let(:technological_scope) { create :scope, organization: organization }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:current_component) { create(:component, participatory_space: participatory_process, manifest_name: "problems") }
+ let(:challenge) { create(:challenge) }
+ let(:sectorial_scope) { create(:scope, organization:) }
+ let(:technological_scope) { create(:scope, organization:) }
let(:tags) { "tag1, tag2, tag3" }
let(:causes) { "causes" }
let(:groups_affected) { "groups affected" }
@@ -32,17 +32,17 @@ module Admin
decidim_challenges_challenge_id: challenge.id,
decidim_sectorial_scope_id: sectorial_scope.id,
decidim_technological_scope_id: technological_scope.id,
- tags: tags,
- causes: causes,
- groups_affected: groups_affected,
- state: state,
- start_date: start_date,
- end_date: end_date,
- proposing_entities: proposing_entities,
- collaborating_entities: collaborating_entities,
- current_user: current_user,
+ tags:,
+ causes:,
+ groups_affected:,
+ state:,
+ start_date:,
+ end_date:,
+ proposing_entities:,
+ collaborating_entities:,
+ current_user:,
current_organization: organization,
- current_component: current_component
+ current_component:
)
end
let(:invalid) { false }
diff --git a/spec/commands/decidim/problems/admin/destroy_problem_spec.rb b/spec/commands/decidim/problems/admin/destroy_problem_spec.rb
index 7676d2eb..c7e3e135 100644
--- a/spec/commands/decidim/problems/admin/destroy_problem_spec.rb
+++ b/spec/commands/decidim/problems/admin/destroy_problem_spec.rb
@@ -8,10 +8,10 @@ module Admin
describe DestroyProblem do
subject { described_class.new(problem, current_user) }
- let(:my_process) { create :participatory_process }
- let!(:current_user) { create :user, email: "some_email@example.org", organization: my_process.organization }
- let!(:user) { create :user, :confirmed, organization: my_process.organization }
- let(:problem) { create :problem }
+ let(:my_process) { create(:participatory_process) }
+ let!(:current_user) { create(:user, email: "some_email@example.org", organization: my_process.organization) }
+ let!(:user) { create(:user, :confirmed, organization: my_process.organization) }
+ let(:problem) { create(:problem) }
context "when everything is ok" do
it "deletes the problem" do
@@ -33,7 +33,7 @@ module Admin
end
context "when has dependent solutions" do
- let(:solution) { create :solution, problem: problem }
+ let(:solution) { create(:solution, problem:) }
it "not deletes the problem" do
expect { subject.call }.not_to change(Decidim::Problems::Problem, :count)
diff --git a/spec/commands/decidim/problems/admin/update_problem_spec.rb b/spec/commands/decidim/problems/admin/update_problem_spec.rb
index c4ba49a8..d8304c54 100644
--- a/spec/commands/decidim/problems/admin/update_problem_spec.rb
+++ b/spec/commands/decidim/problems/admin/update_problem_spec.rb
@@ -8,13 +8,13 @@ module Admin
describe UpdateProblem do
subject { described_class.new(form, problem) }
- let(:organization) { create :organization, available_locales: [:en] }
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:current_component) { create :component, participatory_space: participatory_process, manifest_name: "problems" }
- let(:challenge) { create :challenge }
- let(:sectorial_scope) { create :scope, organization: organization }
- let(:technological_scope) { create :scope, organization: organization }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:current_component) { create(:component, participatory_space: participatory_process, manifest_name: "problems") }
+ let(:challenge) { create(:challenge) }
+ let(:sectorial_scope) { create(:scope, organization:) }
+ let(:technological_scope) { create(:scope, organization:) }
let(:title) { "Problem title" }
let(:tags) { "tag1, tag2, tag3" }
let(:causes) { "causes" }
@@ -33,21 +33,21 @@ module Admin
decidim_challenges_challenge_id: challenge.id,
decidim_sectorial_scope_id: sectorial_scope.id,
decidim_technological_scope_id: technological_scope.id,
- tags: tags,
- causes: causes,
- groups_affected: groups_affected,
- state: state,
- start_date: start_date,
- end_date: end_date,
- proposing_entities: proposing_entities,
- collaborating_entities: collaborating_entities,
- current_user: current_user,
+ tags:,
+ causes:,
+ groups_affected:,
+ state:,
+ start_date:,
+ end_date:,
+ proposing_entities:,
+ collaborating_entities:,
+ current_user:,
current_organization: organization,
- current_component: current_component
+ current_component:
)
end
let(:invalid) { false }
- let(:problem) { create :problem }
+ let(:problem) { create(:problem) }
context "when the form is not valid" do
let(:invalid) { true }
diff --git a/spec/commands/decidim/solutions/admin/create_solution_spec.rb b/spec/commands/decidim/solutions/admin/create_solution_spec.rb
index fc4f9667..c9056ab8 100644
--- a/spec/commands/decidim/solutions/admin/create_solution_spec.rb
+++ b/spec/commands/decidim/solutions/admin/create_solution_spec.rb
@@ -8,12 +8,12 @@ module Admin
describe CreateSolution do
subject { described_class.new(form_with_problem) }
- let(:organization) { create :organization, available_locales: [:en] }
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:current_component) { create :component, participatory_space: participatory_process, manifest_name: "solutions" }
- let(:challenge) { create :challenge }
- let(:problem) { create :problem, challenge: challenge }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:current_component) { create(:component, participatory_space: participatory_process, manifest_name: "solutions") }
+ let(:challenge) { create(:challenge) }
+ let(:problem) { create(:problem, challenge:) }
let(:tags) { "tag1, tag2, tag3" }
let(:objectives) do
{ en: "objectives" }
@@ -39,15 +39,15 @@ module Admin
author_id: current_user.id,
decidim_problems_problem_id: problem.id,
decidim_challenges_challenge_id: nil,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
- current_user: current_user,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
+ current_user:,
current_organization: organization,
- current_component: current_component
+ current_component:
)
end
let(:form_without_problem) do
@@ -59,15 +59,15 @@ module Admin
description: { en: "Solution desc" },
decidim_problems_problem_id: nil,
decidim_challenges_challenge_id: challenge.id,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
- current_user: current_user,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
+ current_user:,
current_organization: organization,
- current_component: current_component
+ current_component:
)
end
let(:invalid) { false }
diff --git a/spec/commands/decidim/solutions/admin/destroy_solution_spec.rb b/spec/commands/decidim/solutions/admin/destroy_solution_spec.rb
index 97621164..105f8516 100644
--- a/spec/commands/decidim/solutions/admin/destroy_solution_spec.rb
+++ b/spec/commands/decidim/solutions/admin/destroy_solution_spec.rb
@@ -8,10 +8,10 @@ module Admin
describe DestroySolution do
subject { described_class.new(solution, current_user) }
- let(:my_process) { create :participatory_process }
- let!(:current_user) { create :user, email: "some_email@example.org", organization: my_process.organization }
- let!(:user) { create :user, :confirmed, organization: my_process.organization }
- let(:solution) { create :solution }
+ let(:my_process) { create(:participatory_process) }
+ let!(:current_user) { create(:user, email: "some_email@example.org", organization: my_process.organization) }
+ let!(:user) { create(:user, :confirmed, organization: my_process.organization) }
+ let(:solution) { create(:solution) }
context "when everything is ok" do
it "deletes the solution" do
diff --git a/spec/commands/decidim/solutions/admin/update_solution_spec.rb b/spec/commands/decidim/solutions/admin/update_solution_spec.rb
index 325a430f..9c7163a7 100644
--- a/spec/commands/decidim/solutions/admin/update_solution_spec.rb
+++ b/spec/commands/decidim/solutions/admin/update_solution_spec.rb
@@ -8,12 +8,12 @@ module Admin
describe UpdateSolution do
subject { described_class.new(form_with_problem, solution) }
- let(:organization) { create :organization, available_locales: [:en] }
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:current_component) { create :component, participatory_space: participatory_process, manifest_name: "solutions" }
- let(:challenge) { create :challenge }
- let(:problem) { create :problem, challenge: challenge }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:current_component) { create(:component, participatory_space: participatory_process, manifest_name: "solutions") }
+ let(:challenge) { create(:challenge) }
+ let(:problem) { create(:problem, challenge:) }
let(:title) { "Solution title" }
let(:tags) { "tag1, tag2, tag3" }
let(:objectives) do
@@ -39,15 +39,15 @@ module Admin
description: { en: "Solution desc" },
decidim_problems_problem_id: problem.id,
decidim_challenges_challenge_id: nil,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
- current_user: current_user,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
+ current_user:,
current_organization: organization,
- current_component: current_component
+ current_component:
)
end
let(:form_without_problem) do
@@ -58,19 +58,19 @@ module Admin
description: { en: "Solution desc" },
decidim_problems_problem_id: nil,
decidim_challenges_challenge_id: challenge.id,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
- current_user: current_user,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
+ current_user:,
current_organization: organization,
- current_component: current_component
+ current_component:
)
end
let(:invalid) { false }
- let(:solution) { create :solution }
+ let(:solution) { create(:solution) }
describe "when module problems is active" do
context "when the form is not valid" do
diff --git a/spec/commands/decidim/solutions/create_solution_spec.rb b/spec/commands/decidim/solutions/create_solution_spec.rb
index 95769dab..6f2a106d 100644
--- a/spec/commands/decidim/solutions/create_solution_spec.rb
+++ b/spec/commands/decidim/solutions/create_solution_spec.rb
@@ -7,11 +7,11 @@ module Solutions
describe CreateSolution do
subject { described_class.new(form) }
- let(:organization) { create :organization, available_locales: [:en] }
- let(:current_user) { create :user, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:current_component) { create :component, participatory_space: participatory_process, manifest_name: "solutions" }
- let(:challenge) { create :challenge }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:current_user) { create(:user, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:current_component) { create(:component, participatory_space: participatory_process, manifest_name: "solutions") }
+ let(:challenge) { create(:challenge) }
let(:project_status) { "in_progress" }
let(:project_url) { "http://test.example.org" }
let(:coordinating_entity) { "Coordinating entity" }
@@ -26,12 +26,12 @@ module Solutions
author_id: current_user.id,
decidim_challenges_challenge_id: challenge.id,
decidim_problems_problem_id: nil,
- project_status: project_status,
- project_url: project_url,
- coordinating_entity: coordinating_entity,
- current_user: current_user,
+ project_status:,
+ project_url:,
+ coordinating_entity:,
+ current_user:,
current_organization: organization,
- current_component: current_component,
+ current_component:,
add_documents: uploaded_files,
)
end
diff --git a/spec/controllers/decidim/challenges/admin/challenges_controller_spec.rb b/spec/controllers/decidim/challenges/admin/challenges_controller_spec.rb
index 788747ac..2328253d 100644
--- a/spec/controllers/decidim/challenges/admin/challenges_controller_spec.rb
+++ b/spec/controllers/decidim/challenges/admin/challenges_controller_spec.rb
@@ -2,10 +2,10 @@
require "spec_helper"
-describe Decidim::Challenges::Admin::ChallengesController, type: :controller do
+describe Decidim::Challenges::Admin::ChallengesController do
routes { Decidim::Challenges::AdminEngine.routes }
- let(:organization) { create :organization, available_locales: [:en] }
+ let(:organization) { create(:organization, available_locales: [:en]) }
let(:title) do
{
en: "Challenge title",
@@ -38,27 +38,27 @@
let(:params) do
{
challenge: {
- title: title,
- local_description: local_description,
- global_description: global_description,
- state: state,
- sdg_code: sdg_code,
- tags: tags,
- start_date: start_date,
- end_date: end_date,
- collaborating_entities: collaborating_entities,
- coordinating_entities: coordinating_entities,
- card_image: card_image,
+ title:,
+ local_description:,
+ global_description:,
+ state:,
+ sdg_code:,
+ tags:,
+ start_date:,
+ end_date:,
+ collaborating_entities:,
+ coordinating_entities:,
+ card_image:,
},
component_id: component,
- scope: scope,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:component) { create :component, participatory_space: participatory_process, manifest_name: "challenges", organization: organization }
- let(:scope) { create :scope, organization: organization }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:component) { create(:component, participatory_space: participatory_process, manifest_name: "challenges", organization:) }
+ let(:scope) { create(:scope, organization:) }
before do
request.env["decidim.current_organization"] = organization
@@ -70,7 +70,7 @@
describe "POST #create" do
context "with all mandatory fields" do
it "creates a challenge" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -87,7 +87,7 @@
end
it "doesn't create a challenge" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:ok)
@@ -96,7 +96,7 @@
end
describe "PUT #update" do
- let(:challenge) { create :challenge, component: component }
+ let(:challenge) { create(:challenge, component:) }
context "with all mandatory fields" do
let(:params) do
@@ -108,24 +108,24 @@
es: "Título reto actualizado",
ca: "Títol repte actualitzat",
},
- local_description: local_description,
- global_description: global_description,
- state: state,
- sdg_code: sdg_code,
- tags: tags,
- start_date: start_date,
- end_date: end_date,
- collaborating_entities: collaborating_entities,
- coordinating_entities: coordinating_entities,
+ local_description:,
+ global_description:,
+ state:,
+ sdg_code:,
+ tags:,
+ start_date:,
+ end_date:,
+ collaborating_entities:,
+ coordinating_entities:,
},
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "updates a challenge" do
- put :update, params: params
+ put(:update, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -143,14 +143,14 @@
ca: nil,
},
},
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "doesn't update a challenge" do
- put :update, params: params
+ put(:update, params:)
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:ok)
@@ -159,18 +159,18 @@
end
describe "DELETE #destroy" do
- let(:challenge) { create :challenge, component: component }
+ let(:challenge) { create(:challenge, component:) }
let(:params) do
{
id: challenge.id,
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "deletes a challenge" do
- delete :destroy, params: params
+ delete(:destroy, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
diff --git a/spec/controllers/decidim/problems/admin/problems_controller_spec.rb b/spec/controllers/decidim/problems/admin/problems_controller_spec.rb
index 748e4ab0..9a289998 100644
--- a/spec/controllers/decidim/problems/admin/problems_controller_spec.rb
+++ b/spec/controllers/decidim/problems/admin/problems_controller_spec.rb
@@ -2,10 +2,10 @@
require "spec_helper"
-describe Decidim::Problems::Admin::ProblemsController, type: :controller do
+describe Decidim::Problems::Admin::ProblemsController do
routes { Decidim::Problems::AdminEngine.routes }
- let(:organization) { create :organization, available_locales: [:en] }
+ let(:organization) { create(:organization, available_locales: [:en]) }
let(:title) do
{
en: "Problem title",
@@ -20,7 +20,7 @@
ca: "Descripció problema",
}
end
- let(:challenge) { create :challenge }
+ let(:challenge) { create(:challenge) }
let(:tags) { "tag1, tag2, tag3" }
let(:causes) { "causes" }
let(:groups_affected) { "groups affected" }
@@ -32,27 +32,27 @@
let(:params) do
{
problem: {
- title: title,
- description: description,
- state: state,
+ title:,
+ description:,
+ state:,
decidim_challenges_challenge_id: challenge.id,
- tags: tags,
- causes: causes,
- groups_affected: groups_affected,
- start_date: start_date,
- end_date: end_date,
- collaborating_entities: collaborating_entities,
- proposing_entities: proposing_entities,
+ tags:,
+ causes:,
+ groups_affected:,
+ start_date:,
+ end_date:,
+ collaborating_entities:,
+ proposing_entities:,
},
component_id: component,
- scope: scope,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:component) { create :component, participatory_space: participatory_process, manifest_name: "problems", organization: organization }
- let(:scope) { create :scope, organization: organization }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:component) { create(:component, participatory_space: participatory_process, manifest_name: "problems", organization:) }
+ let(:scope) { create(:scope, organization:) }
before do
request.env["decidim.current_organization"] = organization
@@ -64,7 +64,7 @@
describe "POST #create" do
context "with all mandatory fields" do
it "creates a problem" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -81,7 +81,7 @@
end
it "doesn't create a problem" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:ok)
@@ -90,7 +90,7 @@
end
describe "PUT #update" do
- let(:problem) { create :problem, component: component }
+ let(:problem) { create(:problem, component:) }
context "with all mandatory fields" do
let(:params) do
@@ -102,25 +102,25 @@
es: "Título problema actualizado",
ca: "Títol problema actualitzat",
},
- description: description,
- state: state,
+ description:,
+ state:,
decidim_challenges_challenge_id: challenge.id,
- tags: tags,
- causes: causes,
- groups_affected: groups_affected,
- start_date: start_date,
- end_date: end_date,
- collaborating_entities: collaborating_entities,
- proposing_entities: proposing_entities,
+ tags:,
+ causes:,
+ groups_affected:,
+ start_date:,
+ end_date:,
+ collaborating_entities:,
+ proposing_entities:,
},
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "updates a problem" do
- put :update, params: params
+ put(:update, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -138,14 +138,14 @@
ca: nil,
},
},
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "doesn't update a problem" do
- put :update, params: params
+ put(:update, params:)
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:ok)
@@ -154,18 +154,18 @@
end
describe "DELETE #destroy" do
- let(:problem) { create :problem, component: component }
+ let(:problem) { create(:problem, component:) }
let(:params) do
{
id: problem.id,
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "deletes a problem" do
- delete :destroy, params: params
+ delete(:destroy, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
diff --git a/spec/controllers/decidim/solutions/admin/solutions_controller_spec.rb b/spec/controllers/decidim/solutions/admin/solutions_controller_spec.rb
index 2a1f9e90..90cd4c0f 100644
--- a/spec/controllers/decidim/solutions/admin/solutions_controller_spec.rb
+++ b/spec/controllers/decidim/solutions/admin/solutions_controller_spec.rb
@@ -2,10 +2,10 @@
require "spec_helper"
-describe Decidim::Solutions::Admin::SolutionsController, type: :controller do
+describe Decidim::Solutions::Admin::SolutionsController do
routes { Decidim::Solutions::AdminEngine.routes }
- let(:organization) { create :organization, available_locales: [:en] }
+ let(:organization) { create(:organization, available_locales: [:en]) }
let(:title) do
{
en: "Solution title",
@@ -20,8 +20,8 @@
ca: "Descripció solució",
}
end
- let(:challenge) { create :challenge }
- let(:problem) { create :problem, challenge: challenge }
+ let(:challenge) { create(:challenge) }
+ let(:problem) { create(:problem, challenge:) }
let(:tags) { "tag1, tag2, tag3" }
let(:objectives) do
{ en: "objectives" }
@@ -41,26 +41,26 @@
let(:params) do
{
solution: {
- title: title,
- description: description,
+ title:,
+ description:,
author_id: current_user.id,
decidim_problems_problem_id: problem.id,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
},
component_id: component,
- scope: scope,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
- let(:current_user) { create :user, :admin, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:component) { create :component, participatory_space: participatory_process, manifest_name: "solutions", organization: organization }
- let(:scope) { create :scope, organization: organization }
+ let(:current_user) { create(:user, :admin, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:component) { create(:component, participatory_space: participatory_process, manifest_name: "solutions", organization:) }
+ let(:scope) { create(:scope, organization:) }
before do
request.env["decidim.current_organization"] = organization
@@ -72,7 +72,7 @@
describe "POST #create" do
context "with all mandatory fields" do
it "creates a solution" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -89,7 +89,7 @@
end
it "doesn't create a solution" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:ok)
@@ -98,7 +98,7 @@
context "when module problem is active" do
it "with problem" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -109,25 +109,25 @@
let(:params) do
{
solution: {
- title: title,
- description: description,
+ title:,
+ description:,
author_id: current_user.id,
decidim_challenges_challenge_id: challenge.id,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
},
component_id: component,
- scope: scope,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "has a challenge" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -136,7 +136,7 @@
end
describe "PUT #update" do
- let(:solution) { create :solution, component: component }
+ let(:solution) { create(:solution, component:) }
context "with all mandatory fields with module problems" do
let(:params) do
@@ -148,25 +148,25 @@
es: "Título solución actualizada",
ca: "Títol solució actualitzada",
},
- description: description,
+ description:,
author_id: current_user.id,
decidim_problems_problem_id: problem.id,
decidim_challenges_challenge_id: nil,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
},
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "updates a solution" do
- put :update, params: params
+ put(:update, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -183,25 +183,25 @@
es: "Título solución actualizada",
ca: "Títol solució actualitzada",
},
- description: description,
+ description:,
author_id: current_user.id,
decidim_problems_problem_id: nil,
decidim_challenges_challenge_id: challenge.id,
- tags: tags,
- objectives: objectives,
- indicators: indicators,
- beneficiaries: beneficiaries,
- financing_type: financing_type,
- requirements: requirements,
+ tags:,
+ objectives:,
+ indicators:,
+ beneficiaries:,
+ financing_type:,
+ requirements:,
},
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "updates a solution" do
- put :update, params: params
+ put(:update, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -219,14 +219,14 @@
ca: nil,
},
},
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "doesn't update a solution" do
- put :update, params: params
+ put(:update, params:)
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:ok)
@@ -235,18 +235,18 @@
end
describe "DELETE #destroy" do
- let(:solution) { create :solution, component: component }
+ let(:solution) { create(:solution, component:) }
let(:params) do
{
id: solution.id,
- component: component,
- scope: scope,
+ component:,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
it "deletes a solution" do
- delete :destroy, params: params
+ delete(:destroy, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
diff --git a/spec/controllers/decidim/solutions/solutions_controller_spec.rb b/spec/controllers/decidim/solutions/solutions_controller_spec.rb
index 1fd45bf3..047b1b55 100644
--- a/spec/controllers/decidim/solutions/solutions_controller_spec.rb
+++ b/spec/controllers/decidim/solutions/solutions_controller_spec.rb
@@ -2,13 +2,13 @@
require "spec_helper"
-describe Decidim::Solutions::SolutionsController, type: :controller do
+describe Decidim::Solutions::SolutionsController do
routes { Decidim::Solutions::Engine.routes }
- let(:organization) { create :organization, available_locales: [:en] }
+ let(:organization) { create(:organization, available_locales: [:en]) }
let(:title) { "Títol solució" }
let(:description) { "Descripció solució" }
- let(:challenge) { create :challenge }
+ let(:challenge) { create(:challenge) }
let(:project_status) { "in_progress" }
let(:project_url) { "http://test.example.org" }
let(:coordinating_entity) { "Coordinating entity" }
@@ -16,25 +16,25 @@
let(:params) do
{
solution: {
- title: title,
- description: description,
+ title:,
+ description:,
author_id: current_user.id,
decidim_challenges_challenge_id: challenge.id,
decidim_problems_problem_id: nil,
- project_status: project_status,
- project_url: project_url,
- coordinating_entity: coordinating_entity,
+ project_status:,
+ project_url:,
+ coordinating_entity:,
add_documents: uploaded_files,
},
component_id: component,
- scope: scope,
+ scope:,
participatory_process_slug: component.participatory_space.slug,
}
end
- let(:current_user) { create :user, :confirmed, organization: organization }
- let(:participatory_process) { create :participatory_process, organization: organization }
- let(:component) { create :component, participatory_space: participatory_process, manifest_name: "solutions", organization: organization, settings: { creation_enabled: true } }
- let(:scope) { create :scope, organization: organization }
+ let(:current_user) { create(:user, :confirmed, organization:) }
+ let(:participatory_process) { create(:participatory_process, organization:) }
+ let(:component) { create(:component, participatory_space: participatory_process, manifest_name: "solutions", organization:, settings: { creation_enabled: true }) }
+ let(:scope) { create(:scope, organization:) }
before do
request.env["decidim.current_organization"] = organization
@@ -46,7 +46,7 @@
describe "POST #create" do
context "with all mandatory fields" do
it "creates a solution" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:notice]).not_to be_empty
expect(response).to have_http_status(:found)
@@ -57,7 +57,7 @@
let(:title) { nil }
it "doesn't create a solution" do
- post :create, params: params
+ post(:create, params:)
expect(flash[:alert]).not_to be_empty
expect(response).to have_http_status(:ok)
diff --git a/spec/forms/decidim/challenges/admin/challenge_surveys_form_spec.rb b/spec/forms/decidim/challenges/admin/challenge_surveys_form_spec.rb
index b42ae18a..e4bba645 100644
--- a/spec/forms/decidim/challenges/admin/challenge_surveys_form_spec.rb
+++ b/spec/forms/decidim/challenges/admin/challenge_surveys_form_spec.rb
@@ -9,11 +9,11 @@ module Decidim::Challenges
let(:challenge) { create(:challenge) }
let(:attributes) do
{
- survey_enabled: survey_enabled,
+ survey_enabled:,
}
end
let(:survey_enabled) { true }
- let(:context) { { current_organization: challenge.organization, challenge: challenge } }
+ let(:context) { { current_organization: challenge.organization, challenge: } }
context "when surveys are enabled" do
it { is_expected.to be_valid }
diff --git a/spec/forms/decidim/challenges/admin/challenges_form_spec.rb b/spec/forms/decidim/challenges/admin/challenges_form_spec.rb
index 6acca5f0..82bb5fe9 100644
--- a/spec/forms/decidim/challenges/admin/challenges_form_spec.rb
+++ b/spec/forms/decidim/challenges/admin/challenges_form_spec.rb
@@ -8,9 +8,9 @@ module Admin
describe ChallengesForm do
subject { described_class.from_params(attributes).with_context(current_organization: organization, current_component: component) }
- let(:component) { create :challenges_component }
+ let(:component) { create(:challenges_component) }
let(:organization) { component.organization }
- let(:scope) { create :scope, organization: organization }
+ let(:scope) { create(:scope, organization:) }
let(:title) do
{
en: "Challenge title",
@@ -68,7 +68,7 @@ module Admin
}
end
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when default language in local_description is missing" do
@@ -78,7 +78,7 @@ module Admin
}
end
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when default language in global_description is missing" do
@@ -88,32 +88,32 @@ module Admin
}
end
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when state is missing" do
let(:state) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when start date is missing" do
let(:start_date) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when end date is missing" do
let(:end_date) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when start date is bigger than end date" do
let(:start_date) { 2.days.from_now }
let(:end_date) { 1.day.from_now }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
end
end
diff --git a/spec/forms/decidim/problems/admin/problems_form_spec.rb b/spec/forms/decidim/problems/admin/problems_form_spec.rb
index cf9bdd00..d396fa7e 100644
--- a/spec/forms/decidim/problems/admin/problems_form_spec.rb
+++ b/spec/forms/decidim/problems/admin/problems_form_spec.rb
@@ -8,8 +8,8 @@ module Admin
describe ProblemsForm do
subject { described_class.from_params(attributes).with_context(current_organization: organization) }
- let(:organization) { create :organization }
- let(:scope) { create :scope, organization: organization }
+ let(:organization) { create(:organization) }
+ let(:scope) { create(:scope, organization:) }
let(:title) do
{
en: "Problem title",
@@ -24,7 +24,7 @@ module Admin
ca: "Descripció problema",
}
end
- let(:challenge) { create :challenge }
+ let(:challenge) { create(:challenge) }
let(:tags) { "tag1, tag2, tag3" }
let(:causes) { "causes" }
let(:groups_affected) { "groups affected" }
@@ -61,7 +61,7 @@ module Admin
}
end
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when default language in description is missing" do
@@ -71,38 +71,38 @@ module Admin
}
end
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when challenge is missing" do
let(:challenge) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when state is missing" do
let(:state) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when start date is missing" do
let(:start_date) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when end date is missing" do
let(:end_date) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when start date is bigger than end date" do
let(:start_date) { 2.days.from_now }
let(:end_date) { 1.day.from_now }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
end
end
diff --git a/spec/forms/decidim/solutions/admin/solutions_form_spec.rb b/spec/forms/decidim/solutions/admin/solutions_form_spec.rb
index 11d0306c..53b42e9a 100644
--- a/spec/forms/decidim/solutions/admin/solutions_form_spec.rb
+++ b/spec/forms/decidim/solutions/admin/solutions_form_spec.rb
@@ -8,9 +8,9 @@ module Admin
describe SolutionsForm do
subject { described_class.from_params(attributes).with_context(current_organization: organization) }
- let(:organization) { create :organization }
- let(:scope) { create :scope, organization: organization }
- let(:current_user) { create :user, :confirmed, organization: organization }
+ let(:organization) { create(:organization) }
+ let(:scope) { create(:scope, organization:) }
+ let(:current_user) { create(:user, :confirmed, organization:) }
let(:title) do
{
en: "Problem title",
@@ -25,8 +25,8 @@ module Admin
ca: "Descripció problema",
}
end
- let(:challenge) { create :challenge }
- let(:problem) { create :problem, challenge: challenge }
+ let(:challenge) { create(:challenge) }
+ let(:problem) { create(:problem, challenge:) }
let(:tags) { "tag1, tag2, tag3" }
let(:objectives) do
{
@@ -91,7 +91,7 @@ module Admin
}
end
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when default language in description is missing" do
@@ -101,7 +101,7 @@ module Admin
}
end
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when problem is missing but there is a challenge" do
diff --git a/spec/forms/decidim/solutions/solutions_form_spec.rb b/spec/forms/decidim/solutions/solutions_form_spec.rb
index d8874690..0db4659b 100644
--- a/spec/forms/decidim/solutions/solutions_form_spec.rb
+++ b/spec/forms/decidim/solutions/solutions_form_spec.rb
@@ -7,12 +7,12 @@ module Solutions
describe SolutionsForm do
subject { described_class.from_params(attributes).with_context(current_organization: organization) }
- let(:organization) { create :organization }
- let(:scope) { create :scope, organization: organization }
- let(:current_user) { create :user, :confirmed, organization: organization }
+ let(:organization) { create(:organization) }
+ let(:scope) { create(:scope, organization:) }
+ let(:current_user) { create(:user, :confirmed, organization:) }
let(:title) { "Títol solució" }
let(:description) { "Descripció solució" }
- let(:challenge) { create :challenge }
+ let(:challenge) { create(:challenge) }
let(:project_status) { "in_progress" }
let(:project_url) { "www.example.org" }
let(:coordinating_entity) { "www.example.org" }
@@ -38,13 +38,13 @@ module Solutions
context "when title is missing" do
let(:title) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when description is missing" do
let(:description) { nil }
- it { is_expected.to be_invalid }
+ it { is_expected.not_to be_valid }
end
context "when problem is missing but there is a challenge" do
diff --git a/spec/helpers/decidim/challenges/challenges_helper_spec.rb b/spec/helpers/decidim/challenges/challenges_helper_spec.rb
index 8b596292..2b088c15 100644
--- a/spec/helpers/decidim/challenges/challenges_helper_spec.rb
+++ b/spec/helpers/decidim/challenges/challenges_helper_spec.rb
@@ -12,8 +12,8 @@ module Decidim::Challenges
context "when solutions are associated to problems" do
let(:problems_component) { create(:problems_component, participatory_space: challenge.participatory_space) }
- let(:problem) { create :problem, component: problems_component, challenge: challenge }
- let!(:solution) { create(:solution, component: solutions_component, problem: problem) }
+ let(:problem) { create(:problem, component: problems_component, challenge:) }
+ let!(:solution) { create(:solution, component: solutions_component, problem:) }
it "shows solutions if the problem is published" do
expect(subject).to include(solution)
@@ -40,7 +40,7 @@ module Decidim::Challenges
end
context "when solutions are associated to challenges" do
- let!(:solution) { create(:solution, component: solutions_component, challenge: challenge) }
+ let!(:solution) { create(:solution, component: solutions_component, challenge:) }
it "shows solutions if challenge is published" do
expect(subject).to include(solution)
diff --git a/spec/lib/decidim/challenges/component_spec.rb b/spec/lib/decidim/challenges/component_spec.rb
index e3ac2c80..40cd8d5c 100644
--- a/spec/lib/decidim/challenges/component_spec.rb
+++ b/spec/lib/decidim/challenges/component_spec.rb
@@ -5,7 +5,7 @@
describe "Challenges component" do
subject { component }
- let(:component) { create :challenges_component }
+ let(:component) { create(:challenges_component) }
context "when check filters are hide in settings" do
before do
diff --git a/spec/lib/decidim/problems/component_spec.rb b/spec/lib/decidim/problems/component_spec.rb
index 8affaf6f..79857857 100644
--- a/spec/lib/decidim/problems/component_spec.rb
+++ b/spec/lib/decidim/problems/component_spec.rb
@@ -5,7 +5,7 @@
describe "Problems component" do
subject { component }
- let(:component) { create :problems_component }
+ let(:component) { create(:problems_component) }
context "when check filters are hide in settings" do
before do
diff --git a/spec/lib/decidim/solutions/component_spec.rb b/spec/lib/decidim/solutions/component_spec.rb
index 83f3f151..38511233 100644
--- a/spec/lib/decidim/solutions/component_spec.rb
+++ b/spec/lib/decidim/solutions/component_spec.rb
@@ -5,7 +5,7 @@
describe "Solutions component" do
subject { component }
- let(:component) { create :solutions_component }
+ let(:component) { create(:solutions_component) }
context "when check filters are hide in settings" do
before do
diff --git a/spec/models/decidim/challenges/survey_spec.rb b/spec/models/decidim/challenges/survey_spec.rb
index 855780b3..01f535ba 100644
--- a/spec/models/decidim/challenges/survey_spec.rb
+++ b/spec/models/decidim/challenges/survey_spec.rb
@@ -8,13 +8,13 @@ module Decidim::Challenges
let(:challenge) { create(:challenge) }
let(:user) { create(:user, organization: challenge.organization) }
- let(:survey) { build :survey, challenge: challenge, user: user }
+ let(:survey) { build(:survey, challenge:, user:) }
it { is_expected.to be_valid }
context "when a survey already exists for the same user and challenge" do
before do
- create :survey, challenge: challenge, user: user
+ create(:survey, challenge:, user:)
end
it { is_expected.not_to be_valid }
diff --git a/spec/permissions/decidim/challenges/admin/permissions_spec.rb b/spec/permissions/decidim/challenges/admin/permissions_spec.rb
index 1c4f12d4..8fc2dc14 100644
--- a/spec/permissions/decidim/challenges/admin/permissions_spec.rb
+++ b/spec/permissions/decidim/challenges/admin/permissions_spec.rb
@@ -5,9 +5,9 @@
describe Decidim::Challenges::Admin::Permissions do
subject { described_class.new(user, permission_action, context).permissions.allowed? }
- let!(:organization) { create :organization }
- let(:user) { create :user, :admin, organization: organization }
- let(:challenge) { create :challenge }
+ let!(:organization) { create(:organization) }
+ let(:user) { create(:user, :admin, organization:) }
+ let(:challenge) { create(:challenge) }
let(:context) { {} }
let(:permission_action) do
Decidim::PermissionAction.new(
diff --git a/spec/permissions/decidim/problems/admin/permissions_spec.rb b/spec/permissions/decidim/problems/admin/permissions_spec.rb
index fab29960..e3357636 100644
--- a/spec/permissions/decidim/problems/admin/permissions_spec.rb
+++ b/spec/permissions/decidim/problems/admin/permissions_spec.rb
@@ -5,9 +5,9 @@
describe Decidim::Problems::Admin::Permissions do
subject { described_class.new(user, permission_action, context).permissions.allowed? }
- let!(:organization) { create :organization }
- let(:user) { create :user, :admin, organization: organization }
- let(:problem) { create :problem }
+ let!(:organization) { create(:organization) }
+ let(:user) { create(:user, :admin, organization:) }
+ let(:problem) { create(:problem) }
let(:context) { {} }
let(:permission_action) do
Decidim::PermissionAction.new(
diff --git a/spec/permissions/decidim/solutions/admin/permissions_spec.rb b/spec/permissions/decidim/solutions/admin/permissions_spec.rb
index a84ddbdc..669cacd4 100644
--- a/spec/permissions/decidim/solutions/admin/permissions_spec.rb
+++ b/spec/permissions/decidim/solutions/admin/permissions_spec.rb
@@ -5,9 +5,9 @@
describe Decidim::Solutions::Admin::Permissions do
subject { described_class.new(user, permission_action, context).permissions.allowed? }
- let!(:organization) { create :organization }
- let(:user) { create :user, :admin, organization: organization }
- let(:solution) { create :solution }
+ let!(:organization) { create(:organization) }
+ let(:user) { create(:user, :admin, organization:) }
+ let(:solution) { create(:solution) }
let(:context) { {} }
let(:permission_action) do
Decidim::PermissionAction.new(
diff --git a/spec/serializers/decidim/challenges/survey_serializer_spec.rb b/spec/serializers/decidim/challenges/survey_serializer_spec.rb
index 841600cb..b0dc1f8b 100644
--- a/spec/serializers/decidim/challenges/survey_serializer_spec.rb
+++ b/spec/serializers/decidim/challenges/survey_serializer_spec.rb
@@ -25,37 +25,37 @@ module Decidim::Challenges
end
context "when questionnaire enabled" do
- let(:challenge) { create :challenge, :with_survey_enabled }
+ let(:challenge) { create(:challenge, :with_survey_enabled) }
let(:serialized) { subject.serialize }
let!(:user) { create(:user, organization: challenge.organization) }
- let!(:survey) { create(:survey, challenge: challenge, user: user) }
+ let!(:survey) { create(:survey, challenge:, user:) }
- let!(:questions) { create_list :questionnaire_question, 3, questionnaire: challenge.questionnaire }
+ let!(:questions) { create_list(:questionnaire_question, 3, questionnaire: challenge.questionnaire) }
let!(:answers) do
questions.map do |question|
- create :answer, questionnaire: challenge.questionnaire, question: question, user: user
+ create(:answer, questionnaire: challenge.questionnaire, question:, user:)
end
end
- let!(:multichoice_question) { create :questionnaire_question, questionnaire: challenge.questionnaire, question_type: "multiple_option" }
- let!(:multichoice_answer_options) { create_list :answer_option, 2, question: multichoice_question }
+ let!(:multichoice_question) { create(:questionnaire_question, questionnaire: challenge.questionnaire, question_type: "multiple_option") }
+ let!(:multichoice_answer_options) { create_list(:answer_option, 2, question: multichoice_question) }
let!(:multichoice_answer) do
- create :answer, questionnaire: challenge.questionnaire, question: multichoice_question, user: user, body: nil
+ create(:answer, questionnaire: challenge.questionnaire, question: multichoice_question, user:, body: nil)
end
let!(:multichoice_answer_choices) do
multichoice_answer_options.map do |answer_option|
- create :answer_choice, answer: multichoice_answer, answer_option: answer_option, body: answer_option.body[I18n.locale.to_s]
+ create(:answer_choice, answer: multichoice_answer, answer_option:, body: answer_option.body[I18n.locale.to_s])
end
end
- let!(:singlechoice_question) { create :questionnaire_question, questionnaire: challenge.questionnaire, question_type: "single_option" }
- let!(:singlechoice_answer_options) { create_list :answer_option, 2, question: multichoice_question }
+ let!(:singlechoice_question) { create(:questionnaire_question, questionnaire: challenge.questionnaire, question_type: "single_option") }
+ let!(:singlechoice_answer_options) { create_list(:answer_option, 2, question: multichoice_question) }
let!(:singlechoice_answer) do
- create :answer, questionnaire: challenge.questionnaire, question: singlechoice_question, user: user, body: nil
+ create(:answer, questionnaire: challenge.questionnaire, question: singlechoice_question, user:, body: nil)
end
let!(:singlechoice_answer_choice) do
answer_option = singlechoice_answer_options.first
- create :answer_choice, answer: singlechoice_answer, answer_option: answer_option, body: answer_option.body[I18n.locale.to_s]
+ create(:answer_choice, answer: singlechoice_answer, answer_option:, body: answer_option.body[I18n.locale.to_s])
end
subject { described_class.new(survey) }
diff --git a/spec/shared/export_survey_user_answers_examples.rb b/spec/shared/export_survey_user_answers_examples.rb
index ccc14f7d..21b5ff5a 100644
--- a/spec/shared/export_survey_user_answers_examples.rb
+++ b/spec/shared/export_survey_user_answers_examples.rb
@@ -2,22 +2,22 @@
shared_examples "export survey user answers" do
let!(:questionnaire) { create(:questionnaire) }
- let!(:questions) { create_list :questionnaire_question, 3, questionnaire: questionnaire }
+ let!(:questions) { create_list(:questionnaire_question, 3, questionnaire:) }
let!(:answers) do
questions.map do |question|
- create_list :answer, 3, questionnaire: questionnaire, question: question
+ create_list(:answer, 3, questionnaire:, question:)
end.flatten
end
it "exports a CSV" do
visit_component_admin
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
- find(".exports.dropdown").click
- perform_enqueued_jobs { click_link "CSV" }
+ find(".exports.button").click
+ perform_enqueued_jobs { click_on "CSV" }
- within ".callout.success" do
+ within ".flash.success" do
expect(page).to have_content("in progress")
end
@@ -28,13 +28,13 @@
it "exports a JSON" do
visit_component_admin
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
- find(".exports.dropdown").click
- perform_enqueued_jobs { click_link "JSON" }
+ find(".exports.button").click
+ perform_enqueued_jobs { click_on "JSON" }
- within ".callout.success" do
+ within ".flash.success" do
expect(page).to have_content("in progress")
end
@@ -45,13 +45,13 @@
it "exports a PDF" do
visit_component_admin
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
- find(".exports.dropdown").click
- perform_enqueued_jobs { click_link "PDF" }
+ find(".exports.button").click
+ perform_enqueued_jobs { click_on "PDF" }
- within ".callout.success" do
+ within ".flash.success" do
expect(page).to have_content("in progress")
end
diff --git a/spec/shared/manage_challenges_examples.rb b/spec/shared/manage_challenges_examples.rb
index e084ccfa..a8e7a0e1 100644
--- a/spec/shared/manage_challenges_examples.rb
+++ b/spec/shared/manage_challenges_examples.rb
@@ -14,88 +14,83 @@
find("a", class: "action-icon--new").click
end
- it "shows help text" do
- expect(help_text_for("label[for*='challenge_start_date']")).to be_present
- expect(help_text_for("label[for*='challenge_end_date']")).to be_present
- end
-
context "when there are multiple locales" do
it "shows the title correctly in all available locales" do
within "#challenge-title-tabs" do
- click_link "English"
+ click_on "English"
end
- expect(page).to have_css("input", text: challenge.title[:en], visible: :visible)
+ expect(page).to have_field(text: challenge.title[:en], visible: :visible)
within "#challenge-title-tabs" do
- click_link "Català"
+ click_on "Català"
end
- expect(page).to have_css("input", text: challenge.title[:ca], visible: :visible)
+ expect(page).to have_field(text: challenge.title[:ca], visible: :visible)
within "#challenge-title-tabs" do
- click_link "Castellano"
+ click_on "Castellano"
end
- expect(page).to have_css("input", text: challenge.title[:es], visible: :visible)
+ expect(page).to have_field(text: challenge.title[:es], visible: :visible)
end
it "shows the local description correctly in all available locales" do
within "#challenge-local_description-tabs" do
- click_link "English"
+ click_on "English"
end
- expect(page).to have_css("input", text: challenge.local_description[:en], visible: :visible)
+ expect(page).to have_field(text: challenge.local_description[:en], visible: :visible)
within "#challenge-local_description-tabs" do
- click_link "Català"
+ click_on "Català"
end
- expect(page).to have_css("input", text: challenge.local_description[:ca], visible: :visible)
+ expect(page).to have_field(text: challenge.local_description[:ca], visible: :visible)
within "#challenge-local_description-tabs" do
- click_link "Castellano"
+ click_on "Castellano"
end
- expect(page).to have_css("input", text: challenge.local_description[:es], visible: :visible)
+ expect(page).to have_field(text: challenge.local_description[:es], visible: :visible)
end
it "shows the global description correctly in all available locales" do
within "#challenge-global_description-tabs" do
- click_link "English"
+ click_on "English"
end
- expect(page).to have_css("input", text: challenge.global_description[:en], visible: :visible)
+ expect(page).to have_field(text: challenge.global_description[:en], visible: :visible)
within "#challenge-global_description-tabs" do
- click_link "Català"
+ click_on "Català"
end
- expect(page).to have_css("input", text: challenge.global_description[:ca], visible: :visible)
+ expect(page).to have_field(text: challenge.global_description[:ca], visible: :visible)
within "#challenge-global_description-tabs" do
- click_link "Castellano"
+ click_on "Castellano"
end
- expect(page).to have_css("input", text: challenge.global_description[:es], visible: :visible)
+ expect(page).to have_field(text: challenge.global_description[:es], visible: :visible)
end
end
context "when there is only one locale" do
- let(:organization) { create :organization, available_locales: [:en] }
- let(:component) { create(:component, manifest_name: manifest_name, organization: organization) }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:component) { create(:component, manifest_name:, organization:) }
let!(:challenge) do
- create(:challenge, scope: scope, component: component,
+ create(:challenge, scope:, component:,
title: { en: "Title" },
local_description: { en: "Local description" },
global_description: { en: "Global description" })
end
it "shows the title correctly" do
- expect(page).not_to have_css("#challenge-title-tabs")
- expect(page).to have_css("input", text: challenge.title[:en], visible: :visible)
+ expect(page).to have_no_css("#challenge-title-tabs")
+ expect(page).to have_field(text: challenge.title[:en], visible: :visible)
end
it "shows the description correctly" do
- expect(page).not_to have_css("#challenge-description-tabs")
- expect(page).to have_css("input", text: challenge.local_description[:en], visible: :visible)
+ expect(page).to have_no_css("#challenge-description-tabs")
+ expect(page).to have_field(text: challenge.local_description[:en], visible: :visible)
end
end
end
it "updates a challenge" do
- within find("tr", text: Decidim::Challenges::ChallengePresenter.new(challenge).title) do
+ within "tr", text: Decidim::Challenges::ChallengePresenter.new(challenge).title do
find("a", class: "action-icon--new").click
end
@@ -118,7 +113,7 @@
end
end
- it "allows the user to preview the challenge"
+ # it "allows the user to preview the challenge"
# do
# within find("tr", text: Decidim::Challenges::ChallengePresenter.new(challenge).title) do
# klass = "action-icon--preview"
@@ -133,7 +128,7 @@
# end
it "creates a new challenge" do
- find(".card-title a.button").click
+ find(".item_show__header-title a.button", text: "New challenge").click
fill_in_i18n(
:challenge_title,
@@ -157,13 +152,10 @@
ca: "Descripció global"
)
- page.execute_script("$('#challenge_start_date').focus()")
- page.find(".datepicker-dropdown .day", text: "12").click
+ fill_in :challenge_start_date, with: Time.current.change(day: 12, hour: 10, min: 50)
+ fill_in :challenge_end_date, with: Time.current.change(day: 12, hour: 10, min: 50)
- page.execute_script("$('#challenge_end_date').focus()")
- page.find(".datepicker-dropdown .day", text: "12").click
-
- scope_pick select_data_picker(:challenge_decidim_scope_id), scope
+ select translated(scope.name), from: :challenge_decidim_scope_id
within ".new_challenge" do
find("*[type=submit]").click
@@ -171,7 +163,7 @@
expect(page).to have_admin_callout("successfully")
- within "table" do
+ within ".card" do
expect(page).to have_content("My challenge")
end
end
@@ -184,8 +176,8 @@
end
it "deletes a challenge" do
- within find("tr", text: Decidim::Challenges::ChallengePresenter.new(challenge_2).title) do
- accept_confirm { click_link "Delete" }
+ within "tr", text: Decidim::Challenges::ChallengePresenter.new(challenge_2).title do
+ accept_confirm { click_on "Delete" }
end
expect(page).to have_admin_callout("successfully")
@@ -195,10 +187,4 @@
end
end
end
-
- private
-
- def help_text_for(css)
- page.find_all(css).first.sibling(".help-text")
- end
end
diff --git a/spec/shared/manage_problems_examples.rb b/spec/shared/manage_problems_examples.rb
index 9631d5b3..39f0c982 100644
--- a/spec/shared/manage_problems_examples.rb
+++ b/spec/shared/manage_problems_examples.rb
@@ -11,7 +11,7 @@
describe "when rendering the text in the update page" do
before do
- find("a", class: "action-icon--new").click
+ find("a", class: "action-icon--new").click_on
end
it "shows help text" do
@@ -22,63 +22,63 @@
context "when there are multiple locales" do
it "shows the title correctly in all available locales" do
within "#problem-title-tabs" do
- click_link "English"
+ click_on "English"
end
- expect(page).to have_css("input", text: problem.title[:en], visible: :visible)
+ expect(page).to have_field("input", text: problem.title[:en], visible: :visible)
within "#problem-title-tabs" do
- click_link "Català"
+ click_on "Català"
end
- expect(page).to have_css("input", text: problem.title[:ca], visible: :visible)
+ expect(page).to have_field("input", text: problem.title[:ca], visible: :visible)
within "#problem-title-tabs" do
- click_link "Castellano"
+ click_on "Castellano"
end
- expect(page).to have_css("input", text: problem.title[:es], visible: :visible)
+ expect(page).to have_field("input", text: problem.title[:es], visible: :visible)
end
it "shows the description correctly in all available locales" do
within "#problem-description-tabs" do
- click_link "English"
+ click_on "English"
end
- expect(page).to have_css("input", text: problem.description[:en], visible: :visible)
+ expect(page).to have_field("input", text: problem.description[:en], visible: :visible)
within "#problem-description-tabs" do
- click_link "Català"
+ click_on "Català"
end
- expect(page).to have_css("input", text: problem.description[:ca], visible: :visible)
+ expect(page).to have_field("input", text: problem.description[:ca], visible: :visible)
within "#problem-description-tabs" do
- click_link "Castellano"
+ click_on "Castellano"
end
- expect(page).to have_css("input", text: problem.description[:es], visible: :visible)
+ expect(page).to have_field("input", text: problem.description[:es], visible: :visible)
end
end
context "when there is only one locale" do
- let(:organization) { create :organization, available_locales: [:en] }
- let(:component) { create(:component, manifest_name: manifest_name, organization: organization) }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:component) { create(:component, manifest_name:, organization:) }
let!(:problem) do
- create(:problem, scope: scope, component: component,
+ create(:problem, scope:, component:,
title: { en: "Problem title" },
description: { en: "Problem description" })
end
it "shows the title correctly" do
- expect(page).not_to have_css("#problem-title-tabs")
- expect(page).to have_css("input", text: problem.title[:en], visible: :visible)
+ expect(page).to have_no_css("#problem-title-tabs")
+ expect(page).to have_field("input", text: problem.title[:en], visible: :visible)
end
it "shows the description correctly" do
- expect(page).not_to have_css("#problem-description-tabs")
- expect(page).to have_css("input", text: problem.description[:en], visible: :visible)
+ expect(page).to have_no_css("#problem-description-tabs")
+ expect(page).to have_field("input", text: problem.description[:en], visible: :visible)
end
end
end
it "updates a problem" do
- within find("tr", text: Decidim::Problems::ProblemPresenter.new(problem).title) do
- find("a", class: "action-icon--new").click
+ within "tr", text: Decidim::Problems::ProblemPresenter.new(problem).title do
+ find("a", class: "action-icon--new").click_on
end
within ".edit_problem" do
@@ -90,7 +90,7 @@
ca: "El meu nou títol"
)
- find("*[type=submit]").click
+ find("*[type=submit]").click_on
end
expect(page).to have_admin_callout("successfully")
@@ -115,7 +115,7 @@
# end
it "creates a new problem" do
- find(".card-title a.button").click
+ find(".card-title a.button").click_on
fill_in_i18n(
:problem_title,
@@ -133,15 +133,15 @@
)
page.execute_script("$('#problem_start_date').focus()")
- page.find(".datepicker-dropdown .day", text: "12").click
+ page.find(".datepicker-dropdown .day", text: "12").click_on
page.execute_script("$('#problem_end_date').focus()")
- page.find(".datepicker-dropdown .day", text: "12").click
+ page.find(".datepicker-dropdown .day", text: "12").click_on
scope_pick select_data_picker(:problem_decidim_scope_id), scope
within ".new_problem" do
- find("*[type=submit]").click
+ find("*[type=submit]").click_on
end
expect(page).to have_admin_callout("successfully")
@@ -159,8 +159,8 @@
end
it "deletes a problem" do
- within find("tr", text: Decidim::Problems::ProblemPresenter.new(problem_2).title) do
- accept_confirm { click_link "Delete" }
+ within "tr", text: Decidim::Problems::ProblemPresenter.new(problem_2).title do
+ accept_confirm { click_on "Delete" }
end
expect(page).to have_admin_callout("successfully")
diff --git a/spec/shared/manage_questionnaires_answers_examples.rb b/spec/shared/manage_questionnaires_answers_examples.rb
index c3d24a88..00fcda72 100644
--- a/spec/shared/manage_questionnaires_answers_examples.rb
+++ b/spec/shared/manage_questionnaires_answers_examples.rb
@@ -5,10 +5,10 @@
shared_examples_for "manage questionnaire answers" do
let(:first_type) { "short_answer" }
let!(:first) do
- create :questionnaire_question, questionnaire: questionnaire, position: 1, question_type: first_type
+ create(:questionnaire_question, questionnaire:, position: 1, question_type: first_type)
end
let!(:second) do
- create :questionnaire_question, questionnaire: questionnaire, position: 2, question_type: "single_option"
+ create(:questionnaire_question, questionnaire:, position: 2, question_type: "single_option")
end
let(:questions) do
[first, second]
@@ -17,30 +17,30 @@
context "when there are no answers" do
it "do not answer admin link" do
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
expect(page).to have_content("No answers yet")
end
end
context "when there are answers" do
- let!(:answer_1) { create :answer, questionnaire: questionnaire, question: first }
- let!(:answer_2) { create :answer, body: "second answer", questionnaire: questionnaire, question: first }
- let!(:answer_3) { create :answer, questionnaire: questionnaire, question: second }
+ let!(:answer_1) { create(:answer, questionnaire:, question: first) }
+ let!(:answer_2) { create(:answer, body: "second answer", questionnaire:, question: first) }
+ let!(:answer_3) { create(:answer, questionnaire:, question: second) }
it "shows the answer admin link" do
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
expect(page).to have_content("Show responses")
end
context "and managing answers page" do
before do
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
- click_link "Show responses"
+ click_on("Survey")
+ click_on("Edit survey")
+ click_on "Show responses"
end
it "shows the anwers page" do
@@ -68,7 +68,7 @@
let(:first_type) { "long_answer" }
it "shows session token" do
- expect(page).not_to have_content(answer_1.body)
+ expect(page).to have_no_content(answer_1.body)
expect(page).to have_content(answer_1.session_token)
expect(page).to have_content(answer_2.session_token)
expect(page).to have_content(answer_3.session_token)
@@ -78,37 +78,37 @@
end
context "and managing individual answer page" do
- let!(:answer_11) { create :answer, questionnaire: questionnaire, body: "", user: answer_1.user, question: second }
+ let!(:answer_11) { create(:answer, questionnaire:, body: "", user: answer_1.user, question: second) }
before do
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
- click_link "Show responses"
+ click_on("Survey")
+ click_on("Edit survey")
+ click_on "Show responses"
end
it "shows all the questions and responses" do
- click_link answer_1.body, match: :first
+ click_on answer_1.body, match: :first
expect(page).to have_content(first.body["en"])
expect(page).to have_content(second.body["en"])
expect(page).to have_content(answer_1.body)
end
it "first answer has a next link" do
- click_link answer_1.body, match: :first
+ click_on answer_1.body, match: :first
expect(page).to have_link("Next ›")
- expect(page).not_to have_link("‹ Prev")
+ expect(page).to have_no_link("‹ Prev")
end
it "second answer has prev/next links" do
- click_link answer_2.body, match: :first
+ click_on answer_2.body, match: :first
expect(page).to have_link("Next ›")
expect(page).to have_link("‹ Prev")
end
it "third answer has prev link" do
- click_link answer_3.session_token, match: :first
- expect(page).not_to have_link("Next ›")
+ click_on answer_3.session_token, match: :first
+ expect(page).to have_no_link("Next ›")
expect(page).to have_link("‹ Prev")
end
end
diff --git a/spec/shared/manage_questionnaires_examples.rb b/spec/shared/manage_questionnaires_examples.rb
index 7bbee5c6..d6930091 100644
--- a/spec/shared/manage_questionnaires_examples.rb
+++ b/spec/shared/manage_questionnaires_examples.rb
@@ -18,8 +18,8 @@
it "updates the questionnaire" do
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
new_description = {
en: "
New description
",
@@ -29,14 +29,14 @@
within "form.edit_questionnaire" do
fill_in_i18n_editor(:questionnaire_description, "#questionnaire-description-tabs", new_description)
- click_button "Save"
+ click_on "Save"
end
expect(page).to have_admin_callout("successfully")
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
expect(page).to have_content("New description")
end
@@ -44,8 +44,6 @@
# context "when the questionnaire is not already answered" do
# before do
# visit questionnaire_edit_path
- # click_link("Survey")
- # click_link("Edit survey")
# end
# it_behaves_like "add questions"
@@ -55,54 +53,54 @@
# end
context "when the questionnaire is already answered" do
- let!(:question) { create(:questionnaire_question, questionnaire: questionnaire, body: body, question_type: "multiple_option") }
- let!(:answer) { create(:answer, questionnaire: questionnaire, question: question) }
+ let!(:question) { create(:questionnaire_question, questionnaire:, body:, question_type: "multiple_option") }
+ let!(:answer) { create(:answer, questionnaire:, question:) }
it "cannot modify questionnaire questions" do
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
expect(page).to have_no_content("Add question")
expect(page).to have_no_content("Remove")
expand_all_questions
- expect(page).to have_selector("input[value='This is the first question'][disabled]")
- expect(page).to have_selector("select[id$=question_type][disabled]")
- expect(page).to have_selector("select[id$=max_choices][disabled]")
- expect(page).to have_selector("input[id$=max_characters][disabled]")
- expect(page).to have_selector(".ql-editor[contenteditable=false]")
+ expect(page).to have_css("input[value='This is the first question'][disabled]")
+ expect(page).to have_css("select[id$=question_type][disabled]")
+ expect(page).to have_css("select[id$=max_choices][disabled]")
+ expect(page).to have_css("input[id$=max_characters][disabled]")
+ expect(page).to have_css(".ProseMirror[contenteditable=false]")
end
end
private
def find_nested_form_field_locator(attribute, visible: :visible)
- find_nested_form_field(attribute, visible: visible)["id"]
+ find_nested_form_field(attribute, visible:)["id"]
end
def find_nested_form_field(attribute, visible: :visible)
- current_scope.find(nested_form_field_selector(attribute), visible: visible)
+ current_scope.find(nested_form_field_selector(attribute), visible:)
end
def have_nested_field(attribute, with:)
- have_field find_nested_form_field_locator(attribute), with: with
+ have_field find_nested_form_field_locator(attribute), with:
end
def have_no_nested_field(attribute, with:)
- have_no_field(find_nested_form_field_locator(attribute), with: with)
+ have_no_field(find_nested_form_field_locator(attribute), with:)
end
def nested_form_field_selector(attribute)
"[id$=#{attribute}]"
end
- def within_add_display_condition(&block)
+ def within_add_display_condition(&)
within ".questionnaire-question:last-of-type" do
- click_button "Add display condition"
+ click_on "Add display condition"
- within ".questionnaire-question-display-condition:last-of-type", &block
+ within(".questionnaire-question-display-condition:last-of-type", &)
end
end
@@ -112,8 +110,8 @@ def expand_all_questions
def visit_questionnaire_edit_path_and_expand_all
visit questionnaire_edit_path
- click_link("Survey")
- click_link("Edit survey")
+ click_on("Survey")
+ click_on("Edit survey")
expand_all_questions
end
end
diff --git a/spec/shared/manage_solutions_examples.rb b/spec/shared/manage_solutions_examples.rb
index 889b6c9a..c765010a 100644
--- a/spec/shared/manage_solutions_examples.rb
+++ b/spec/shared/manage_solutions_examples.rb
@@ -11,71 +11,71 @@
describe "when rendering the text in the update page" do
before do
- find("a", class: "action-icon--new").click
+ find("a", class: "action-icon--new").click_on
end
context "when there are multiple locales" do
it "shows the title correctly in all available locales" do
within "#solution-title-tabs" do
- click_link "English"
+ click_on "English"
end
- expect(page).to have_css("input", text: solution.title[:en], visible: :visible)
+ expect(page).to have_field("input", text: solution.title[:en], visible: :visible)
within "#solution-title-tabs" do
- click_link "Català"
+ click_on "Català"
end
- expect(page).to have_css("input", text: solution.title[:ca], visible: :visible)
+ expect(page).to have_field("input", text: solution.title[:ca], visible: :visible)
within "#solution-title-tabs" do
- click_link "Castellano"
+ click_on "Castellano"
end
- expect(page).to have_css("input", text: solution.title[:es], visible: :visible)
+ expect(page).to have_field("input", text: solution.title[:es], visible: :visible)
end
it "shows the description correctly in all available locales" do
within "#solution-description-tabs" do
- click_link "English"
+ click_on "English"
end
- expect(page).to have_css("input", text: solution.description[:en], visible: :visible)
+ expect(page).to have_field("input", text: solution.description[:en], visible: :visible)
within "#solution-description-tabs" do
- click_link "Català"
+ click_on "Català"
end
- expect(page).to have_css("input", text: solution.description[:ca], visible: :visible)
+ expect(page).to have_field("input", text: solution.description[:ca], visible: :visible)
within "#solution-description-tabs" do
- click_link "Castellano"
+ click_on "Castellano"
end
- expect(page).to have_css("input", text: solution.description[:es], visible: :visible)
+ expect(page).to have_field("input", text: solution.description[:es], visible: :visible)
end
end
context "when there is only one locale" do
- let(:organization) { create :organization, available_locales: [:en] }
- let(:component) { create(:component, manifest_name: manifest_name, organization: organization) }
- let(:challenge) { create :challenge }
- let(:problem) { create :problem, challenge: challenge }
+ let(:organization) { create(:organization, available_locales: [:en]) }
+ let(:component) { create(:component, manifest_name:, organization:) }
+ let(:challenge) { create(:challenge) }
+ let(:problem) { create(:problem, challenge:) }
let!(:solution) do
- create(:solution, scope: scope, component: component, problem: problem,
+ create(:solution, scope:, component:, problem:,
title: { en: "Solution title" },
description: { en: "Solution description" })
end
it "shows the title correctly" do
- expect(page).not_to have_css("#solution-title-tabs")
- expect(page).to have_css("input", text: solution.title[:en], visible: :visible)
+ expect(page).to have_no_css("#solution-title-tabs")
+ expect(page).to have_field("input", text: solution.title[:en], visible: :visible)
end
it "shows the description correctly" do
- expect(page).not_to have_css("#solution-description-tabs")
- expect(page).to have_css("input", text: solution.description[:en], visible: :visible)
+ expect(page).to have_no_css("#solution-description-tabs")
+ expect(page).to have_field("input", text: solution.description[:en], visible: :visible)
end
end
end
it "updates a solution" do
- within find("tr", text: Decidim::Solutions::SolutionPresenter.new(solution).title) do
- find("a", class: "action-icon--new").click
+ within "tr", text: Decidim::Solutions::SolutionPresenter.new(solution).title do
+ find("a", class: "action-icon--new").click_on
end
within ".edit_solution" do
@@ -87,7 +87,7 @@
ca: "El meu nou títol"
)
- find("*[type=submit]").click
+ find("*[type=submit]").click_on
end
expect(page).to have_admin_callout("successfully")
@@ -112,7 +112,7 @@
# end
it "creates a new solution" do
- find(".card-title a.button").click
+ find(".card-title a.button").click_on
fill_in_i18n(
:solution_title,
@@ -129,12 +129,12 @@
ca: "Descripció de la solució"
)
- page.find("#solution_decidim_problems_problem_id").value(problem.id)
+ page.find_by_id("solution_decidim_problems_problem_id").value(problem.id)
scope_pick select_data_picker(:solution_decidim_scope_id), scope
within ".new_solution" do
- find("*[type=submit]").click
+ find("*[type=submit]").click_on
end
expect(page).to have_admin_callout("successfully")
@@ -145,17 +145,17 @@
end
describe "deleting a solution" do
- let(:challenge) { create :challenge }
- let(:problem) { create :problem, challenge: challenge }
- let!(:solution_2) { create(:solution, component: current_component, problem: problem) }
+ let(:challenge) { create(:challenge) }
+ let(:problem) { create(:problem, challenge:) }
+ let!(:solution_2) { create(:solution, component: current_component, problem:) }
before do
visit current_path
end
it "deletes a solution" do
- within find("tr", text: Decidim::Solutions::SolutionPresenter.new(solution_2).title) do
- accept_confirm { click_link "Delete" }
+ within "tr", text: Decidim::Solutions::SolutionPresenter.new(solution_2).title do
+ accept_confirm { click_on "Delete" }
end
expect(page).to have_admin_callout("successfully")
diff --git a/spec/shared/manage_surveys_examples.rb b/spec/shared/manage_surveys_examples.rb
deleted file mode 100644
index 97492877..00000000
--- a/spec/shared/manage_surveys_examples.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-# frozen_string_literal: true
-
-def visit_edit_survey_page
- within find("tr", text: translated(challenge.title)) do
- page.click_link "Survey"
- end
-end
-
-shared_examples "manage surveys" do
- it "enable and configure surveys" do
- visit_edit_survey_page
-
- within ".edit_challenge" do
- check :challenge_survey_enabled
-
- click_button "Save"
- end
-
- expect(page).to have_admin_callout("The challenge survey have been successfully saved.\n×")
- end
-
- context "when exporting surveys answers", driver: :rack_test do
- let!(:surveys) { create_list :survey, 10, challenge: challenge }
-
- it "exports a CSV" do
- visit_edit_survey_page
-
- find(".exports.dropdown").click
-
- click_link "Answers as CSV"
-
- expect(page.response_headers["Content-Type"]).to eq("text/csv")
- expect(page.response_headers["Content-Disposition"]).to match(/attachment; filename=.*\.csv/)
- end
-
- it "exports a JSON" do
- visit_edit_survey_page
-
- find(".exports.dropdown").click
-
- click_link "Answers as JSON"
-
- expect(page.response_headers["Content-Type"]).to eq("text/json")
- expect(page.response_headers["Content-Disposition"]).to match(/attachment; filename=.*\.json/)
- end
- end
-end
diff --git a/spec/shared/unreportable_searchable_results_examples.rb b/spec/shared/unreportable_searchable_results_examples.rb
index ea608f90..6e39c328 100644
--- a/spec/shared/unreportable_searchable_results_examples.rb
+++ b/spec/shared/unreportable_searchable_results_examples.rb
@@ -9,6 +9,7 @@
shared_examples "unreportable searchable results" do
let(:organization) { create(:organization) }
+ let(:search_input_selector) { "input#input-search" }
before do
switch_to_host(organization.host)
@@ -23,20 +24,20 @@
it "contains these searchables" do
fill_in "term", with: term
- find("input#term").native.send_keys :enter
+ find(search_input_selector).native.send_keys :enter
expect(page).to have_current_path decidim.search_path, ignore_query: true
- expect(page).to have_content(/results for the search: "#{term}"/i)
- expect(page).to have_selector(".filters__section")
- expect(page.find("#search-count .section-heading").text.to_i).to be_positive
+ expect(page).to have_content(%(Results for the search: "#{term}"))
+ expect(page).to have_css(".filter-search.filter-container")
+ expect(page.find("#search-count h1").text.to_i).to be_positive
end
it "finds content by hashtag" do
if respond_to?(:hashtag)
fill_in "term", with: hashtag
- find("input#term").native.send_keys :enter
+ find(search_input_selector).native.send_keys :enter
- expect(page.find("#search-count .section-heading").text.to_i).to be_positive
+ expect(page.find("#search-count h1").text.to_i).to be_positive
within "#results" do
expect(page).to have_content(hashtag)
@@ -51,23 +52,23 @@
expect(term).not_to be_empty
fill_in "term", with: term
- find("input#term").native.send_keys :enter
+ find(search_input_selector).native.send_keys :enter
expect(page).to have_current_path decidim.search_path, ignore_query: true
- expect(page).to have_content(/results for the search: "#{term}"/i)
- expect(page).to have_selector(".filters__section")
- expect(page.find("#search-count .section-heading").text.to_i).not_to be_positive
+ expect(page).to have_content(%(Results for the search: "#{term}"))
+ expect(page).to have_css(".filter-search.filter-container")
+ expect(page.find("#search-count h1").text.to_i).not_to be_positive
end
it "doesn't find content by hashtag" do
if respond_to?(:hashtag)
fill_in "term", with: hashtag
- find("input#term").native.send_keys :enter
+ find(search_input_selector).native.send_keys :enter
- expect(page.find("#search-count .section-heading").text.to_i).not_to be_positive
+ expect(page.find("#search-count h1").text.to_i).not_to be_positive
within "#results" do
- expect(page).not_to have_content(hashtag)
+ expect(page).to have_no_content(hashtag)
end
end
end
diff --git a/spec/system/decidim/challenges/admin_manages_challenge_survey_spec.rb b/spec/system/decidim/challenges/admin_manages_challenge_survey_spec.rb
index 089d6a6d..d21d93fb 100644
--- a/spec/system/decidim/challenges/admin_manages_challenge_survey_spec.rb
+++ b/spec/system/decidim/challenges/admin_manages_challenge_survey_spec.rb
@@ -2,17 +2,17 @@
require "spec_helper"
-describe "Admin manages challenge survey", type: :system do
+describe "Admin manages challenge survey" do
let(:manifest_name) { "challenges" }
let!(:component) do
create(:component,
- manifest: manifest,
- participatory_space: participatory_space,
+ manifest:,
+ participatory_space:,
published_at: nil)
end
- let!(:questionnaire) { create :questionnaire }
- let!(:challenge) { create :challenge, component: component, questionnaire: questionnaire }
- let(:survey) { create(:survey, challenge: challenge) }
+ let!(:questionnaire) { create(:questionnaire) }
+ let!(:challenge) { create(:challenge, component:, questionnaire:) }
+ let(:survey) { create(:survey, challenge:) }
include_context "when managing a component as an admin"
@@ -25,10 +25,10 @@
component.unpublish!
end
- let!(:question) { create(:questionnaire_question, questionnaire: questionnaire) }
+ let!(:question) { create(:questionnaire_question, questionnaire:) }
it "show edit survey button" do
- click_link("Survey")
+ click_on("Survey")
expect(page).to have_content("Edit survey")
end
@@ -40,25 +40,25 @@
context "when the survey has answers" do
before do
visit questionnaire_edit_path
- click_link("Survey")
+ click_on("Survey")
visit edit_challenge_surveys_form_path
end
- let!(:answer) { create(:answer, question: question, questionnaire: questionnaire) }
+ let!(:answer) { create(:answer, question:, questionnaire:) }
it "allows editing questions" do
- click_button "Expand all"
- expect(page).to have_selector("#questionnaire_questions_#{question.id}_body_en")
+ click_on "Expand all"
+ expect(page).to have_css("#questionnaire_questions_#{question.id}_body_en")
expect(page).to have_no_selector("#questionnaire_questions_#{question.id}_body_en[disabled]")
end
it "deletes answers after editing" do
- click_button "Expand all"
+ click_on "Expand all"
within "form.edit_questionnaire" do
- within "#questionnaire_question_#{question.id}-field" do
+ within "#accordion-questionnaire_question_#{question.id}-field" do
find_nested_form_field("body_en").fill_in with: "Have you been writing specs today?"
end
- click_button "Save"
+ click_on "Save"
end
expect(page).to have_admin_callout("successfully")
@@ -72,13 +72,13 @@ def questionnaire_edit_path
end
def edit_challenge_surveys_form_path
- ::Decidim::EngineRouter.admin_proxy(component).edit_challenge_surveys_form_path(challenge.id)
+ Decidim::EngineRouter.admin_proxy(component).edit_challenge_surveys_form_path(challenge.id)
end
private
def find_nested_form_field(attribute, visible: :visible)
- current_scope.find(nested_form_field_selector(attribute), visible: visible)
+ current_scope.find(nested_form_field_selector(attribute), visible:)
end
def nested_form_field_selector(attribute)
diff --git a/spec/system/decidim/challenges/admin_manages_challenges_spec.rb b/spec/system/decidim/challenges/admin_manages_challenges_spec.rb
index dbbe86a0..6ba022bb 100644
--- a/spec/system/decidim/challenges/admin_manages_challenges_spec.rb
+++ b/spec/system/decidim/challenges/admin_manages_challenges_spec.rb
@@ -2,12 +2,11 @@
require "spec_helper"
-describe "Admin manages challenges", type: :system, serves_map: true, serves_geocoding_autocomplete: true do
+describe "Admin manages challenges", serves_map: true, serves_geocoding_autocomplete: true do
let(:manifest_name) { "challenges" }
- let!(:challenge) { create :challenge, scope: scope, component: current_component }
+ let!(:challenge) { create(:challenge, scope:, component: current_component) }
include_context "when managing a component as an admin"
it_behaves_like "manage challenges"
- it_behaves_like "manage surveys"
end
diff --git a/spec/system/decidim/challenges/challenge_surveys_spec.rb b/spec/system/decidim/challenges/challenge_surveys_spec.rb
index 3a1757a9..f4c8736a 100644
--- a/spec/system/decidim/challenges/challenge_surveys_spec.rb
+++ b/spec/system/decidim/challenges/challenge_surveys_spec.rb
@@ -3,14 +3,14 @@
require "spec_helper"
require "decidim/forms/test/shared_examples/has_questionnaire"
-describe "Challenge surveys", type: :system do
+describe "Challenge surveys" do
include_context "with a component"
let(:manifest_name) { "challenges" }
let!(:questionnaire) { create(:questionnaire) }
- let!(:question) { create(:questionnaire_question, questionnaire: questionnaire, position: 0) }
- let!(:challenge) { create :challenge, component: component, questionnaire: questionnaire }
- let!(:user) { create :user, :confirmed, organization: organization }
+ let!(:question) { create(:questionnaire_question, questionnaire:, position: 0) }
+ let!(:challenge) { create(:challenge, component:, questionnaire:) }
+ let!(:user) { create(:user, :confirmed, organization:) }
let(:survey_enabled) { true }
let(:survey_form_enabled) { false }
@@ -25,7 +25,7 @@ def questionnaire_public_path
before do
challenge.update!(
- survey_enabled: survey_enabled,
+ survey_enabled:,
)
end
@@ -35,8 +35,8 @@ def questionnaire_public_path
it "the survey button is not visible" do
visit_challenge
- within ".card.extra .card__content" do
- expect(page).not_to have_button("ANSWER SURVEY")
+ within ".layout-aside__buttons" do
+ expect(page).to have_no_button("ANSWER SURVEY")
end
end
@@ -51,15 +51,15 @@ def questionnaire_public_path
context "when challenge surveys are enabled" do
before do
- create(:survey, challenge: challenge, user: user)
+ create(:survey, challenge:, user:)
end
context "and the user is not logged in" do
it "they have the option to sign in" do
visit questionnaire_public_path
- expect(page).not_to have_css(".form.answer-questionnaire")
- expect(page).to have_content("Sign in with your account or sign up to answer the form")
+ expect(page).to have_no_css(".form.answer-questionnaire")
+ expect(page).to have_content("Already have an account?")
end
end
end
diff --git a/spec/system/decidim/challenges/challenges_global_search_spec.rb b/spec/system/decidim/challenges/challenges_global_search_spec.rb
index b5fa46a1..fcb7c8fa 100644
--- a/spec/system/decidim/challenges/challenges_global_search_spec.rb
+++ b/spec/system/decidim/challenges/challenges_global_search_spec.rb
@@ -2,10 +2,10 @@
require "spec_helper"
-describe "Search challenges", type: :system do
+describe "Search challenges" do
include_context "with a component"
let(:manifest_name) { "challenges" }
- let!(:searchables) { create_list(:challenge, 3, component: component) }
+ let!(:searchables) { create_list(:challenge, 3, component:) }
let!(:term) { translated(searchables.first.title).split.last }
before do
diff --git a/spec/system/decidim/challenges/challenges_spec.rb b/spec/system/decidim/challenges/challenges_spec.rb
index 38761f86..8baf34d7 100644
--- a/spec/system/decidim/challenges/challenges_spec.rb
+++ b/spec/system/decidim/challenges/challenges_spec.rb
@@ -2,46 +2,47 @@
require "spec_helper"
-describe "Challenges", type: :system do
+describe "Challenges", :slow do
+ include ActionView::Helpers::SanitizeHelper
+
include_context "with a component"
let(:manifest_name) { "challenges" }
- let(:solutions_component) { create(:solutions_component, participatory_space: challenge.participatory_space) }
-
describe "#show" do
context "when a challenge has contents" do
- let!(:challenge) { create(:challenge, component: component) }
+ let!(:challenge) { create(:challenge, component:) }
let(:problems_component) { create(:problems_component, participatory_space: challenge.participatory_space) }
- let(:problem) { create :problem, component: problems_component, challenge: challenge }
- let!(:solution) { create(:solution, component: solutions_component, problem: problem) }
+ let!(:problem) { create(:problem, component: problems_component, challenge:) }
+ let(:solutions_component) { create(:solutions_component, participatory_space: challenge.participatory_space) }
+ let!(:solution) { create(:solution, component: solutions_component, problem:) }
before do
visit_component
- click_link translated(challenge.title)
+ click_on translated(challenge.title)
end
it "does render the contents" do
expect(page).to have_content("Keywords")
expect(page).to have_content(translated(challenge.tags))
- expect(page).to have_content("Associated problems")
+ expect(page).to have_content("1 problem")
expect(page).to have_content(translated(problem.title))
- expect(page).to have_content("Proposed solutions")
+ expect(page).to have_content("1 solution")
expect(page).to have_content(translated(solution.title))
end
end
context "when a challenge optional contents are empty" do
- let!(:challenge) { create(:challenge, component: component, tags: {}) }
+ let!(:challenge) { create(:challenge, component:, tags: {}) }
before do
visit_component
- click_link translated(challenge.title)
+ click_link_or_button translated(challenge.title)
end
it "does not render titles for empty contents" do
- expect(page).not_to have_content("Keywords")
- expect(page).not_to have_content("Associated problems")
- expect(page).not_to have_content("Proposed solutions")
+ expect(page).to have_no_content("Keywords")
+ expect(page).to have_no_content("1 problem")
+ expect(page).to have_no_content("1 solution")
end
end
end
@@ -49,46 +50,44 @@
describe("#index") do
context "when list challenges" do
let(:other_component) { create(:challenges_component, :with_card_image_allowed) }
- let!(:older_challenge) { create(:challenge, component: component, created_at: 1.month.ago) }
- let!(:recent_challenge) { create(:challenge, component: component, created_at: Time.now.utc) }
+ let!(:older_challenge) { create(:challenge, component:, created_at: 1.month.ago) }
+ let!(:recent_challenge) { create(:challenge, component:, created_at: Time.now.utc) }
let!(:other_component_challenge) { create(:challenge, component: other_component, created_at: Time.now.utc) }
- let!(:challenges) { create_list(:challenge, 2, component: component) }
+ let!(:challenges) { create_list(:challenge, 2, component:) }
before do
visit_component
end
it "show only challenges of current component" do
- expect(page).to have_selector(".card--challenge", count: 4)
+ expect(page).to have_css(".card__list", count: 4)
expect(page).to have_content(translated(challenges.first.title))
expect(page).to have_content(translated(challenges.last.title))
end
it "ordered randomly" do
within ".order-by" do
- expect(page).to have_selector("ul[data-dropdown-menu$=dropdown-menu]", text: "Random")
+ page.find("a", text: "Random").click
end
- expect(page).to have_selector(".card--challenge", count: 4)
+ expect(page).to have_css(".card__list", count: 4)
expect(page).to have_content(translated(challenges.first.title))
expect(page).to have_content(translated(challenges.last.title))
end
it "ordered by created at" do
within ".order-by" do
- expect(page).to have_selector("ul[data-dropdown-menu$=dropdown-menu]", text: "Random")
- page.find("a", text: "Random").click
- click_link "Most recent"
+ page.find("a", text: "Most recent").click
end
- expect(page).to have_selector("#challenges .card-grid .column:first-child", text: recent_challenge.title[:en])
- expect(page).to have_selector("#challenges .card-grid .column:last-child", text: older_challenge.title[:en])
+ expect(page).to have_css(".order-by .button:first-child", text: recent_challenge.title[:en])
+ expect(page).to have_css(".order-by .button:last-child", text: older_challenge.title[:en])
end
end
context "when card images are allow" do
- let!(:challenge_with_card_image) { create(:challenge, :with_card_image, component: component) }
- let!(:challenge) { create(:challenge, component: component) }
+ let!(:challenge_with_card_image) { create(:challenge, :with_card_image, component:) }
+ let!(:challenge) { create(:challenge, component:) }
context "when list all challenges" do
before do
@@ -97,8 +96,8 @@
end
it "show cards with images" do
- expect(page).to have_selector(".card--challenge", count: 2)
- expect(page).to have_selector(".card__image", count: 1)
+ expect(page).to have_css(".card__list", count: 2)
+ expect(page).to have_css(".card__list-image", count: 2)
expect(page).to have_content(translated(challenge_with_card_image.title))
expect(page).to have_content(translated(challenge.title))
diff --git a/spec/system/decidim/challenges/filter_challenges_spec.rb b/spec/system/decidim/challenges/filter_challenges_spec.rb
index fa975004..fb1beac2 100644
--- a/spec/system/decidim/challenges/filter_challenges_spec.rb
+++ b/spec/system/decidim/challenges/filter_challenges_spec.rb
@@ -2,23 +2,22 @@
require "spec_helper"
-describe "Filter Challenges", :slow, type: :system do
+describe "Filter Challenges", :slow do
include_context "with a component"
let(:manifest_name) { "challenges" }
- let!(:category) { create :category, participatory_space: participatory_process }
- let!(:scope) { create :scope, organization: organization }
- let!(:user) { create :user, :confirmed, organization: organization }
- let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization: organization, scope: scope) }
+ let!(:scope) { create(:scope, organization:) }
+ let!(:user) { create(:user, :confirmed, organization:) }
+ let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization:, scope:) }
describe "when filtering challenges by SCOPE" do
let(:scopes_picker) { select_data_picker(:filter_scope_id, multiple: true, global_value: "global") }
- let!(:scope_2) { create :scope, organization: participatory_process.organization }
+ let!(:scope_2) { create(:scope, organization: participatory_process.organization) }
before do
- create_list(:challenge, 2, component: component, scope: scope)
- create(:challenge, component: component, scope: scope_2)
- create(:challenge, component: component, scope: nil)
+ create_list(:challenge, 2, component:, scope:)
+ create(:challenge, component:, scope: scope_2)
+ create(:challenge, component:, scope: nil)
visit_component
end
@@ -30,78 +29,78 @@
context "when selecting the global scope" do
it "lists the filtered challenges", :slow do
- within ".filters .with_any_scope_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "Scope" do
uncheck "All"
check "Global"
end
- expect(page).to have_css(".card--challenge", count: 1)
- expect(page).to have_content("1 CHALLENGE")
+ expect(page).to have_css(".card__list", count: 1)
+ expect(page).to have_content("1 challenge")
end
end
context "when selecting one scope" do
it "lists the filtered challenges", :slow do
- within ".filters .with_any_scope_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "Scope" do
uncheck "All"
check scope.name[I18n.locale.to_s]
end
- expect(page).to have_css(".card--challenge", count: 2)
- expect(page).to have_content("2 CHALLENGES")
+ expect(page).to have_css(".card__list", count: 2)
+ expect(page).to have_content("2 challenges")
end
end
context "when selecting the global scope and another scope" do
it "lists the filtered challenges", :slow do
- within ".filters .with_any_scope_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "Scope" do
uncheck "All"
check "Global"
check scope.name[I18n.locale.to_s]
end
- expect(page).to have_css(".card--challenge", count: 3)
- expect(page).to have_content("3 CHALLENGES")
+ expect(page).to have_css(".card__list", count: 3)
+ expect(page).to have_content("3 challenges")
end
end
context "when unselecting the selected scope" do
it "lists the filtered challenges" do
- within ".filters .with_any_scope_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "Scope" do
uncheck "All"
check scope.name[I18n.locale.to_s]
check "Global"
uncheck scope.name[I18n.locale.to_s]
end
- expect(page).to have_css(".card--challenge", count: 1)
- expect(page).to have_content("1 CHALLENGE")
+ expect(page).to have_css(".card__list", count: 1)
+ expect(page).to have_content("1 challenge")
end
end
- context "when process is related to a scope" do
- let(:participatory_process) { scoped_participatory_process }
+ # context "when process is related to a scope" do
+ # let(:participatory_process) { scoped_participatory_process }
- it "cannot be filtered by scope" do
- visit_component
+ # it "cannot be filtered by scope" do
+ # visit_component
- within "form.new_filter" do
- expect(page).to have_no_content(/Scope/i)
- end
- end
+ # within "form.new_filter" do
+ # expect(page).to have_no_content(/Scope/i)
+ # end
+ # end
- context "with subscopes" do
- let!(:subscopes) { create_list :subscope, 5, parent: scope }
+ # context "with subscopes" do
+ # let!(:subscopes) { create_list(:subscope, 5, parent: scope) }
- it "can be filtered by scope" do
- visit_component
+ # it "can be filtered by scope" do
+ # visit_component
- within "form.new_filter" do
- expect(page).to have_content(/Scope/i)
- end
- end
- end
- end
+ # within "form.new_filter" do
+ # expect(page).to have_content(/Scope/i)
+ # end
+ # end
+ # end
+ # end
end
describe "when filtering challenges by STATE" do
@@ -114,125 +113,92 @@
end
it "lists proposal challenges" do
- create(:challenge, :proposal, component: component, scope: scope)
+ create(:challenge, :proposal, component:, scope:)
visit_component
- within ".filters .with_any_state_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "State" do
check "All"
uncheck "All"
check "Proposal"
end
- expect(page).to have_css(".card--challenge", count: 1)
- expect(page).to have_content("1 CHALLENGE")
+ expect(page).to have_css(".card__list", count: 1)
+ expect(page).to have_content("1 challenge")
- within ".card--challenge" do
- expect(page).to have_content("PROPOSAL")
+ within ".card__list" do
+ expect(page).to have_content("Proposal")
end
end
it "lists the filtered challenges" do
- create(:challenge, :execution, component: component, scope: scope)
+ create(:challenge, :execution, component:, scope:)
visit_component
- within ".filters .with_any_state_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "State" do
check "All"
uncheck "All"
check "Execution"
end
- expect(page).to have_css(".card--challenge", count: 1)
- expect(page).to have_content("1 CHALLENGE")
-
- within ".card--challenge" do
- expect(page).to have_content("EXECUTION")
- end
- end
- end
-
- describe "when filtering challenges by SDG" do
- context "when the participatory_space does NOT contain an SDGs component" do
- before do
- visit_component
- end
-
- it "the filter is not rendered" do
- expect(page).not_to have_css(".filters__section.sdgs-filter")
- end
- end
-
- context "when the participatory_space DOES contain an SDGs component" do
- let!(:sdgs_component) { create(:component, participatory_space: participatory_process, manifest_name: "sdgs") }
-
- before do
- create_list(:challenge, 2, component: component, sdg_code: :no_poverty)
- create(:challenge, component: component, sdg_code: :zero_hunger)
- create(:challenge, component: component, sdg_code: :good_health)
- create(:challenge, component: component, sdg_code: nil)
- visit_component
- end
-
- it "the filter is rendered" do
- expect(page).to have_css(".filters__section.sdgs-filter")
- end
-
- context "when NOT selecting any SDG" do
- it "lists all the challenges" do
- expect(page).to have_css(".card--challenge", count: 5)
- expect(page).to have_content("5 CHALLENGES")
- end
- end
-
- context "when selecting some SDGs" do
- before do
- find(".filters__section.sdgs-filter button").click
- expect(page).to have_css("#sdgs-modal")
-
- within "#sdgs-modal" do
- find('.sdg-cell[data-value="no_poverty"]').click
- find('.sdg-cell[data-value="good_health"]').click
- find(".reveal__footer a.button").click
- end
- end
+ expect(page).to have_css(".card__list", count: 1)
+ expect(page).to have_content("1 challenge")
- it "lists the challenges with the selected SDGs" do
- expect(page).to have_css(".card--challenge", count: 3)
- expect(page).to have_content("3 CHALLENGES")
- end
+ within ".card__list" do
+ expect(page).to have_content("Execution")
end
end
end
- context "when filtering challenges by CATEGORY" do
- let!(:challenge) { create(:challenge, component: component, category: category) }
-
- before do
- login_as user, scope: :user
- visit_component
- end
-
- it "can be filtered by category" do
- within ".filters .with_any_category_check_boxes_tree_filter" do
- uncheck "All"
- check category.name[I18n.locale.to_s]
- end
-
- expect(page).to have_css(".card--challenge", count: 1)
- end
-
- it "works with 'back to list' link" do
- within ".filters .with_any_category_check_boxes_tree_filter" do
- uncheck "All"
- check category.name[I18n.locale.to_s]
- end
-
- expect(page).to have_css(".card--challenge", count: 1)
-
- page.find(".card--challenge .card__link").click
-
- click_link "Return to list"
-
- expect(page).to have_css(".card--challenge", count: 1)
- end
- end
+ # describe "when filtering challenges by SDG" do
+ # context "when the participatory_space does NOT contain an SDGs component" do
+ # before do
+ # visit_component
+ # end
+
+ # it "the filter is not rendered" do
+ # expect(page).to have_no_css(".filters__section.sdgs-filter")
+ # end
+ # end
+
+ # context "when the participatory_space DOES contain an SDGs component" do
+ # let!(:sdgs_component) { create(:component, participatory_space: participatory_process, manifest_name: "sdgs") }
+
+ # before do
+ # create_list(:challenge, 2, component:, sdg_code: :no_poverty)
+ # create(:challenge, component:, sdg_code: :zero_hunger)
+ # create(:challenge, component:, sdg_code: :good_health)
+ # create(:challenge, component:, sdg_code: nil)
+ # visit_component
+ # end
+
+ # it "the filter is rendered" do
+ # expect(page).to have_field(".filters__section.sdgs-filter")
+ # end
+
+ # context "when NOT selecting any SDG" do
+ # it "lists all the challenges" do
+ # expect(page).to have_field(".card--challenge", count: 5)
+ # expect(page).to have_content("5 CHALLENGES")
+ # end
+ # end
+
+ # context "when selecting some SDGs" do
+ # before do
+ # find(".filters__section.sdgs-filter button").click_on
+ # expect(page).to have_field("#sdgs-modal")
+
+ # within "#sdgs-modal" do
+ # find('.sdg-cell[data-value="no_poverty"]').click_on
+ # find('.sdg-cell[data-value="good_health"]').click_on
+ # find(".reveal__footer a.button").click_on
+ # end
+ # end
+
+ # it "lists the challenges with the selected SDGs" do
+ # expect(page).to have_field(".card--challenge", count: 3)
+ # expect(page).to have_content("3 CHALLENGES")
+ # end
+ # end
+ # end
+ # end
end
diff --git a/spec/system/decidim/challenges/without_filters_challenges_spec.rb b/spec/system/decidim/challenges/without_filters_challenges_spec.rb
index 1e7be8ec..db545e02 100644
--- a/spec/system/decidim/challenges/without_filters_challenges_spec.rb
+++ b/spec/system/decidim/challenges/without_filters_challenges_spec.rb
@@ -2,34 +2,29 @@
require "spec_helper"
-describe "Without filters Challenges", :slow, type: :system do
+describe "Without filters Challenges", :slow do
include_context "with a component"
let(:manifest_name) { "challenges" }
- let!(:category) { create :category, participatory_space: participatory_process }
- let!(:scope) { create :scope, organization: organization }
- let!(:user) { create :user, :confirmed, organization: organization }
- let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization: organization, scope: scope) }
+ let!(:scope) { create(:scope, organization:) }
+ let!(:user) { create(:user, :confirmed, organization:) }
+ let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization:, scope:) }
describe "when filters are hide" do
let(:scopes_picker) { select_data_picker(:filter_scope_id, multiple: true, global_value: "global") }
- let!(:scope_2) { create :scope, organization: participatory_process.organization }
+ let!(:scope_2) { create(:scope, organization: participatory_process.organization) }
before do
component.settings = { hide_filters: true }
component.save!
- create_list(:challenge, 2, component: component, scope: scope)
- create(:challenge, component: component, scope: scope_2)
- create(:challenge, component: component, scope: nil)
+ create_list(:challenge, 2, component:, scope:)
+ create(:challenge, component:, scope: scope_2)
+ create(:challenge, component:, scope: nil)
visit_component
end
- it "show challenges in three columns" do
- expect(page).to have_css(".mediumlarge-11.large-12")
- end
-
it "not show filters" do
- expect(page).not_to have_css(".filters")
+ expect(page).to have_no_css(".new_filter")
end
end
end
diff --git a/spec/system/decidim/filter_resources_by_scope_examples.rb b/spec/system/decidim/filter_resources_by_scope_examples.rb
index cf5e6f5f..276c0d4c 100644
--- a/spec/system/decidim/filter_resources_by_scope_examples.rb
+++ b/spec/system/decidim/filter_resources_by_scope_examples.rb
@@ -1,91 +1,88 @@
# frozen_string_literal: true
-RSpec.shared_examples "when filtering resources by a scope" do |singular_rsrc_name_counter, card_css_class, checkboxes_tree_filter_css_class|
+RSpec.shared_examples "when filtering resources by a scope" do |filter_name, card_css_reference|
let(:scopes_picker) { select_data_picker(:filter_scope_id, multiple: true, global_value: "global") }
- let!(:scope_2) { create :scope, organization: participatory_process.organization }
+ let!(:scope_2) { create(:scope, organization: participatory_process.organization) }
before do
visit_component
end
- it "can be filtered by scope" do
+ it "can be filtered by #{filter_name}" do
within "form.new_filter" do
- expect(page).to have_content(/Scope/i)
+ expect(page).to have_content(filter_name)
end
end
- context "when selecting the global scope" do
+ context "when selecting the global #{filter_name}" do
it "lists the filtered resources", :slow do
- within ".filters #{checkboxes_tree_filter_css_class}" do
+ within "#dropdown-menu-filters div.filter-container", text: filter_name do
uncheck "All"
check "Global"
end
- expect(page).to have_css(card_css_class, count: 1)
- expect(page).to have_content("1 #{singular_rsrc_name_counter}")
+ expect(page).to have_css(card_css_reference, count: 1)
end
end
- context "when selecting one scope" do
+ context "when selecting one #{filter_name}" do
it "lists the filtered resources", :slow do
- within ".filters #{checkboxes_tree_filter_css_class}" do
+ within "#dropdown-menu-filters div.filter-container", text: filter_name do
uncheck "All"
check scope.name[I18n.locale.to_s]
end
- expect(page).to have_css(card_css_class, count: 2)
- expect(page).to have_content("2 #{singular_rsrc_name_counter}S")
+ expect(page).to have_css(card_css_reference, count: 2)
end
end
- context "when selecting the global scope and another scope" do
+ context "when selecting the global #{filter_name} and another #{filter_name}" do
it "lists the filtered resources", :slow do
- within ".filters #{checkboxes_tree_filter_css_class}" do
+ within "#dropdown-menu-filters div.filter-container", text: filter_name do
uncheck "All"
check "Global"
check scope.name[I18n.locale.to_s]
end
- expect(page).to have_css(card_css_class, count: 3)
- expect(page).to have_content("3 #{singular_rsrc_name_counter}S")
+ expect(page).to have_css(card_css_reference, count: 3)
end
end
context "when unselecting the selected scope" do
it "lists the filtered resources" do
- within ".filters #{checkboxes_tree_filter_css_class}" do
+ within "#dropdown-menu-filters div.filter-container", text: filter_name do
uncheck "All"
check scope.name[I18n.locale.to_s]
check "Global"
uncheck scope.name[I18n.locale.to_s]
end
- expect(page).to have_css(card_css_class, count: 1)
- expect(page).to have_content("1 #{singular_rsrc_name_counter}")
+ expect(page).to have_css(card_css_reference, count: 1)
end
end
- context "when process is related to a scope" do
- let(:participatory_process) { scoped_participatory_process }
+ # TODO: to review
+ # context "when process is related to a scope" do
+ # let(:participatory_process) { scoped_participatory_process }
- it "cannot be filtered by scope" do
- visit_component
+ # it "cannot be filtered by scope" do
+ # visit_component
- within "form.new_filter" do
- expect(page).to have_no_content(/Scope/i)
- end
- end
+ # within "form.new_filter" do
+ # expect(page).to have_no_content(filter_name)
+ # end
+ # end
- context "with subscopes" do
- let!(:subscopes) { create_list :subscope, 5, parent: scope }
+ # context "with subscopes" do
+ # let!(:subscopes) { create_list(:subscope, 5, parent: scope) }
- it "can be filtered by scope" do
- visit_component
+ # it "can be filtered by scope" do
+ # visit_component
- within "form.new_filter" do
- expect(page).to have_content(/Scope/i)
- end
- end
- end
- end
+ # within "form.new_filter" do
+ # expect(page).to have_content(filter_name)
+ # end
+ # end
+ # end
+ # end
end
diff --git a/spec/system/decidim/problems/admin/manage_problems_spec.rb b/spec/system/decidim/problems/admin/manage_problems_spec.rb
index f0e4ba79..1f030239 100644
--- a/spec/system/decidim/problems/admin/manage_problems_spec.rb
+++ b/spec/system/decidim/problems/admin/manage_problems_spec.rb
@@ -2,11 +2,12 @@
require "spec_helper"
-describe "Admin creates problems", type: :system do
+# rubocop:disable Capybara/SpecificMatcher
+describe "Admin creates problems" do
let(:manifest_name) { "problems" }
let(:organization) { participatory_process.organization }
- let!(:user) { create :user, :admin, :confirmed, organization: organization }
- let!(:problem) { create :problem, component: component }
+ let!(:user) { create(:user, :admin, :confirmed, organization:) }
+ let!(:problem) { create(:problem, component:) }
include_context "when managing a component as an admin"
@@ -15,10 +16,8 @@
visit_component_admin
find("a.button", text: "New Problem").click
- within(".card-title", match: :first) do
- expect(page).to have_content organization.name
- end
expect(page).to have_css "input#problem_title_en"
end
end
end
+# rubocop:enable Capybara/SpecificMatcher
diff --git a/spec/system/decidim/problems/filter_problems_spec.rb b/spec/system/decidim/problems/filter_problems_spec.rb
index 55e06df9..4f3981a8 100644
--- a/spec/system/decidim/problems/filter_problems_spec.rb
+++ b/spec/system/decidim/problems/filter_problems_spec.rb
@@ -3,14 +3,13 @@
require "spec_helper"
require_relative "../filter_resources_by_scope_examples"
-describe "Filter Problems", :slow, type: :system do
+describe "Filter Problems", :slow do
include_context "with a component"
let(:manifest_name) { "problems" }
- let!(:category) { create :category, participatory_space: participatory_process }
- let!(:scope) { create :scope, organization: organization }
- let!(:user) { create :user, :confirmed, organization: organization }
- let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization: organization, scope: scope) }
+ let!(:scope) { create(:scope, organization:) }
+ let!(:user) { create(:user, :confirmed, organization:) }
+ let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization:, scope:) }
# describe "when filtering problems by challenge" do
pending "finds the problems associated with the given challenge"
@@ -18,28 +17,29 @@
describe "when filtering problems by sectorial and technological scopes" do
before do
- create_list(:problem, 2, component: component, sectorial_scope: scope, technological_scope: scope)
- create(:problem, component: component, sectorial_scope: scope_2, technological_scope: scope_2)
- create(:problem, component: component, sectorial_scope: nil, technological_scope: nil)
+ create_list(:problem, 2, component:, sectorial_scope: scope, technological_scope: scope)
+ create(:problem, component:, sectorial_scope: scope_2, technological_scope: scope_2)
+ create(:problem, component:, sectorial_scope: nil, technological_scope: nil)
end
- include_examples "when filtering resources by a scope", "PROBLEM", ".card--problem", ".with_any_sectorial_scope_id_check_boxes_tree_filter"
- include_examples "when filtering resources by a scope", "PROBLEM", ".card--problem", ".with_any_technological_scope_id_check_boxes_tree_filter"
+ include_examples "when filtering resources by a scope", "Sectorial scope", ".card__list"
+ include_examples "when filtering resources by a scope", "Technological scope", ".card__list"
end
- describe "when filtering problems by challenge's territorial scopes" do
- before do
- challenges_component = create(:challenges_component, participatory_space: participatory_process)
- challenge = create(:challenge, component: challenges_component, scope: scope)
- create_list(:problem, 2, component: component, challenge: challenge)
- challenge_2 = create(:challenge, component: challenges_component, scope: scope_2)
- create(:problem, component: component, challenge: challenge_2)
- challenge_no_scope = create(:challenge, component: challenges_component, scope: nil)
- create(:problem, component: component, challenge: challenge_no_scope)
- end
+ # TODO: not show in screen
+ # describe "when filtering problems by challenge's territorial scopes" do
+ # before do
+ # challenges_component = create(:challenges_component, participatory_space: participatory_process)
+ # challenge = create(:challenge, component: challenges_component, scope:)
+ # create_list(:problem, 2, component:, challenge:)
+ # challenge_2 = create(:challenge, component: challenges_component, scope: scope_2)
+ # create(:problem, component:, challenge: challenge_2)
+ # challenge_no_scope = create(:challenge, component: challenges_component, scope: nil)
+ # create(:problem, component:, challenge: challenge_no_scope)
+ # end
- include_examples "when filtering resources by a scope", "PROBLEM", ".card--problem", ".with_any_territorial_scope_id_check_boxes_tree_filter"
- end
+ # include_examples "when filtering resources by a scope", "Territorial scope" ".card__list"
+ # end
describe "when filtering problems by STATE" do
it "can be filtered by state" do
@@ -51,134 +51,52 @@
end
it "lists proposal problems" do
- create(:problem, :proposal, component: component)
+ create(:problem, :proposal, component:)
visit_component
- within ".filters .with_any_state_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "State" do
check "All"
uncheck "All"
check "Proposal"
end
- expect(page).to have_css(".card--problem", count: 1)
- expect(page).to have_content("1 PROBLEM")
+ expect(page).to have_css(".card__list", count: 1)
+ expect(page).to have_content("1 problem")
- within ".card--problem" do
- expect(page).to have_content("PROPOSAL")
+ within ".card__list" do
+ expect(page).to have_content("Proposal")
end
end
it "lists the filtered problems" do
- # create(:problem, :execution, component: component, scope: scope)
- create(:problem, :execution, component: component)
+ create(:problem, :execution, component:)
visit_component
- within ".filters .with_any_state_check_boxes_tree_filter" do
+ within "#dropdown-menu-filters div.filter-container", text: "State" do
check "All"
uncheck "All"
check "Execution"
end
- expect(page).to have_css(".card--problem", count: 1)
- expect(page).to have_content("1 PROBLEM")
+ expect(page).to have_css(".card__list", count: 1)
+ expect(page).to have_content("1 problem")
- within ".card--problem" do
- expect(page).to have_content("EXECUTION")
+ within ".card__list" do
+ expect(page).to have_content("Execution")
end
end
end
- describe "when filtering problems by SDG" do
- context "when the participatory_space does NOT contain an SDGs component" do
- before do
- visit_component
- end
-
- it "the filter is not rendered" do
- expect(page).not_to have_css(".filters__section.sdgs-filter")
- end
- end
-
- context "when the participatory_space DOES contain an SDGs component" do
- let!(:sdgs_component) { create(:sdgs_component, participatory_space: participatory_process) }
- let!(:challenges_component) { create(:challenges_component, participatory_space: participatory_process) }
-
- before do
- challenge = create(:challenge, component: challenges_component, sdg_code: :no_poverty)
- create_list(:problem, 2, component: component, challenge: challenge)
- challenge = create(:challenge, component: challenges_component, sdg_code: :zero_hunger)
- create(:problem, component: component, challenge: challenge)
- challenge = create(:challenge, component: challenges_component, sdg_code: :good_health)
- create(:problem, component: component, challenge: challenge)
- challenge = create(:challenge, component: challenges_component)
- create(:problem, component: component, challenge: challenge)
- visit_component
- end
-
- it "the filter is rendered" do
- expect(page).to have_css(".filters__section.sdgs-filter")
- end
-
- context "when NOT selecting any SDG" do
- it "lists all the problems" do
- expect(page).to have_css(".card--problem", count: 5)
- expect(page).to have_content("5 PROBLEMS")
- end
- end
-
- context "when selecting some SDGs" do
- before do
- find(".filters__section.sdgs-filter button").click
- expect(page).to have_css("#sdgs-modal")
-
- within "#sdgs-modal" do
- find('.sdg-cell[data-value="no_poverty"]').click
- find('.sdg-cell[data-value="good_health"]').click
- find(".reveal__footer a.button").click
- end
- end
-
- it "lists the problems with the selected SDGs" do
- expect(page).to have_css(".card--problem", count: 3)
- expect(page).to have_content("3 PROBLEMS")
- end
- end
- end
- end
-
- # context "when filtering problems by CATEGORY", :slow do
- # context "when the user is logged in" do
- # let!(:category2) { create :category, participatory_space: participatory_process }
- # let!(:category3) { create :category, participatory_space: participatory_process }
- # let!(:problem1) { create(:problem, component: component, category: category) }
- # let!(:problem2) { create(:problem, component: component, category: category2) }
- # let!(:problem3) { create(:problem, component: component, category: category3) }
-
+ # describe "when filtering problems by SDG" do
+ # context "when the participatory_space does NOT contain an SDGs component" do
# before do
- # login_as user, scope: :user
- # end
-
- # it "can be filtered by a category" do
# visit_component
-
- # within ".filters .category_id_check_boxes_tree_filter" do
- # uncheck "All"
- # check category.name[I18n.locale.to_s]
- # end
-
- # expect(page).to have_css(".card--problem", count: 1)
# end
- # it "can be filtered by two categories" do
- # visit_component
-
- # within ".filters .category_id_check_boxes_tree_filter" do
- # uncheck "All"
- # check category.name[I18n.locale.to_s]
- # check category2.name[I18n.locale.to_s]
+ # it "the filter is not rendered" do
+ # within "form.new_filter" do
+ # expect(page).to have_no_content("SDGs")
# end
-
- # expect(page).to have_css(".card--problem", count: 2)
# end
# end
# end
@@ -193,48 +111,35 @@
# visit_component
# end
- # it "recover filters from initial pages" do
- # within ".filters .state_check_boxes_tree_filter" do
- # check "Rejected"
+ # it "the filter is rendered" do
+ # expect(page).to have_content("SDGs")
# end
- # expect(page).to have_css(".card.card--problem", count: 8)
-
- # page.go_back
-
- # expect(page).to have_css(".card.card--problem", count: 6)
- # end
-
- # it "recover filters from previous pages" do
- # within ".filters .state_check_boxes_tree_filter" do
- # check "All"
- # uncheck "All"
- # end
- # within ".filters .origin_check_boxes_tree_filter" do
- # uncheck "All"
- # end
-
- # within ".filters .origin_check_boxes_tree_filter" do
- # check "Official"
- # end
-
- # within ".filters .state_check_boxes_tree_filter" do
- # check "Accepted"
+ # context "when NOT selecting any SDG" do
+ # it "lists all the problems" do
+ # expect(page).to have_css(".card__list", count: 5)
+ # expect(page).to have_content("5 problems")
+ # end
# end
- # expect(page).to have_css(".card.card--problem", count: 2)
-
- # page.go_back
+ # context "when selecting some SDGs" do
+ # before do
- # expect(page).to have_css(".card.card--problem", count: 6)
+ # find(".filters__section.sdgs-filter button").click_on
+ # expect(page).to have_field("#sdgs-modal")
- # page.go_back
-
- # expect(page).to have_css(".card.card--problem", count: 8)
-
- # page.go_forward
+ # within "#sdgs-modal" do
+ # find('.sdg-cell[data-value="no_poverty"]').click_on
+ # find('.sdg-cell[data-value="good_health"]').click_on
+ # find(".reveal__footer a.button").click_on
+ # end
+ # end
- # expect(page).to have_css(".card.card--problem", count: 6)
+ # it "lists the problems with the selected SDGs" do
+ # expect(page).to have_field(".card__list", count: 3)
+ # expect(page).to have_content("3 PROBLEMS")
+ # end
+ # end
# end
# end
end
diff --git a/spec/system/decidim/problems/problems_global_search_spec.rb b/spec/system/decidim/problems/problems_global_search_spec.rb
index 2baafa21..e12d9b0d 100644
--- a/spec/system/decidim/problems/problems_global_search_spec.rb
+++ b/spec/system/decidim/problems/problems_global_search_spec.rb
@@ -2,10 +2,10 @@
require "spec_helper"
-describe "Problems global search", type: :system do
+describe "Problems global search" do
include_context "with a component"
let(:manifest_name) { "problems" }
- let!(:searchables) { create_list(:problem, 3, component: component) }
+ let!(:searchables) { create_list(:problem, 3, component:) }
let!(:term) { translated(searchables.first.title).split.last }
before do
diff --git a/spec/system/decidim/problems/problems_spec.rb b/spec/system/decidim/problems/problems_spec.rb
index eeafa6f2..ee9bff79 100644
--- a/spec/system/decidim/problems/problems_spec.rb
+++ b/spec/system/decidim/problems/problems_spec.rb
@@ -2,7 +2,7 @@
require "spec_helper"
-describe "Problems", type: :system do
+describe "Problems" do
include_context "with a component"
let(:manifest_name) { "problems" }
@@ -10,33 +10,33 @@
describe "#show" do
context "when a problem has contents" do
- let!(:problem) { create(:problem, component: component) }
- let!(:solution) { create(:solution, component: solutions_component, problem: problem) }
+ let!(:problem) { create(:problem, component:) }
+ let!(:solution) { create(:solution, component: solutions_component, problem:) }
before do
visit_component
- click_link translated(problem.title)
+ click_on translated(problem.title)
end
it "does render the contents" do
expect(page).to have_content("Keywords")
expect(page).to have_content(translated(problem.tags))
- expect(page).to have_content("Proposed solutions")
+ expect(page).to have_content("1 solution")
expect(page).to have_content(translated(solution.title))
end
end
context "when a problem optional contents are empty" do
- let!(:problem) { create(:problem, component: component, tags: {}) }
+ let!(:problem) { create(:problem, component:, tags: {}) }
before do
visit_component
- click_link translated(problem.title)
+ click_on translated(problem.title)
end
it "does not render titles for empty contents" do
- expect(page).not_to have_content("Keywords")
- expect(page).not_to have_content("Proposed solutions")
+ expect(page).to have_no_content("Keywords")
+ expect(page).to have_no_content("solutions")
end
end
end
@@ -44,40 +44,38 @@
describe("#index") do
context "when list problems" do
let(:other_component) { create(:problems_component) }
- let!(:older_problem) { create(:problem, component: component, created_at: 1.month.ago) }
- let!(:recent_problem) { create(:problem, component: component, created_at: Time.now.utc) }
+ let!(:older_problem) { create(:problem, component:, created_at: 1.month.ago) }
+ let!(:recent_problem) { create(:problem, component:, created_at: Time.now.utc) }
let!(:other_component_problem) { create(:problem, component: other_component, created_at: Time.now.utc) }
- let!(:problems) { create_list(:problem, 2, component: component) }
+ let!(:problems) { create_list(:problem, 2, component:) }
before do
visit_component
end
it "show only problems of current component" do
- expect(page).to have_selector(".card--problem", count: 4)
+ expect(page).to have_css(".card__list", count: 4)
expect(page).to have_content(translated(problems.first.title))
expect(page).to have_content(translated(problems.last.title))
end
it "ordered randomly" do
within ".order-by" do
- expect(page).to have_selector("ul[data-dropdown-menu$=dropdown-menu]", text: "Random")
+ page.find("a", text: "Random").click
end
- expect(page).to have_selector(".card--problem", count: 4)
+ expect(page).to have_css(".card__list", count: 4)
expect(page).to have_content(translated(problems.first.title))
expect(page).to have_content(translated(problems.last.title))
end
it "ordered by created at" do
within ".order-by" do
- expect(page).to have_selector("ul[data-dropdown-menu$=dropdown-menu]", text: "Random")
- page.find("a", text: "Random").click
- click_link "Most recent"
+ page.find("a", text: "Most recent").click
end
- expect(page).to have_selector("#problems .card-grid .column:first-child", text: recent_problem.title[:en])
- expect(page).to have_selector("#problems .card-grid .column:last-child", text: older_problem.title[:en])
+ expect(page).to have_css(".order-by .button:first-child", text: recent_problem.title[:en])
+ expect(page).to have_css(".order-by .button:last-child", text: older_problem.title[:en])
end
end
end
diff --git a/spec/system/decidim/problems/without_filters_problems_spec.rb b/spec/system/decidim/problems/without_filters_problems_spec.rb
index 901bfadd..833778f2 100644
--- a/spec/system/decidim/problems/without_filters_problems_spec.rb
+++ b/spec/system/decidim/problems/without_filters_problems_spec.rb
@@ -2,40 +2,35 @@
require "spec_helper"
-describe "Without filters Problems", :slow, type: :system do
+describe "Without filters Problems", :slow do
include_context "with a component"
let(:manifest_name) { "problems" }
- let!(:category) { create :category, participatory_space: participatory_process }
- let!(:scope) { create :scope, organization: organization }
- let!(:user) { create :user, :confirmed, organization: organization }
- let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization: organization, scope: scope) }
+ let!(:scope) { create(:scope, organization:) }
+ let!(:user) { create(:user, :confirmed, organization:) }
+ let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization:, scope:) }
describe "when filters are hide" do
let(:scopes_picker) { select_data_picker(:filter_scope_id, multiple: true, global_value: "global") }
- let!(:scope_2) { create :scope, organization: participatory_process.organization }
+ let!(:scope_2) { create(:scope, organization: participatory_process.organization) }
before do
component.settings = { hide_filters: true }
component.save!
challenges_component = create(:challenges_component, participatory_space: participatory_process)
- challenge = create(:challenge, component: challenges_component, scope: scope)
- create_list(:problem, 2, component: component, challenge: challenge)
+ challenge = create(:challenge, component: challenges_component, scope:)
+ create_list(:problem, 2, component:, challenge:)
challenge_2 = create(:challenge, component: challenges_component, scope: scope_2)
- create(:problem, component: component, challenge: challenge_2)
+ create(:problem, component:, challenge: challenge_2)
challenge_no_scope = create(:challenge, component: challenges_component, scope: nil)
- create(:problem, component: component, challenge: challenge_no_scope)
+ create(:problem, component:, challenge: challenge_no_scope)
visit_component
end
- it "show challenges in three columns" do
- expect(page).to have_css(".mediumlarge-11.large-12")
- end
-
it "not show filters" do
- expect(page).not_to have_css(".filters")
+ expect(page).to have_no_css(".filters")
end
end
end
diff --git a/spec/system/decidim/sdgs/admin/manage_sdgs_spec.rb b/spec/system/decidim/sdgs/admin/manage_sdgs_spec.rb
index db049a5b..52ba41f3 100644
--- a/spec/system/decidim/sdgs/admin/manage_sdgs_spec.rb
+++ b/spec/system/decidim/sdgs/admin/manage_sdgs_spec.rb
@@ -2,10 +2,10 @@
require "spec_helper"
-describe "Admin accesses SDGs", type: :system do
+describe "Admin accesses SDGs" do
let(:manifest_name) { "sdgs" }
let(:organization) { participatory_process.organization }
- let!(:user) { create :user, :admin, :confirmed, organization: organization }
+ let!(:user) { create(:user, :admin, :confirmed, organization:) }
let(:components_path) { decidim_admin_participatory_processes.components_path(participatory_process) }
include_context "when managing a component as an admin"
diff --git a/spec/system/decidim/sdgs/browse_sdgs_spec.rb b/spec/system/decidim/sdgs/browse_sdgs_spec.rb
index 2c51075e..0daae655 100644
--- a/spec/system/decidim/sdgs/browse_sdgs_spec.rb
+++ b/spec/system/decidim/sdgs/browse_sdgs_spec.rb
@@ -2,16 +2,13 @@
require "spec_helper"
-describe "Public Sustainable Development Goals", type: :system do
+describe "Public Sustainable Development Goals" do
include_context "with a component"
let(:manifest_name) { "sdgs" }
- # rubocop:disable Style/FormatStringToken
- let(:ods_ids) { [*1..17].map! { |n| "#ods-#{format "%
02d", n: n}" } }
- let(:objective_ids) { [*1..17].map! { |n| "#objective_#{format "%02d", n: n}" } }
- # rubocop:enable Style/FormatStringToken
-
+ let(:ods_ids) { [*1..17].map! { |n| "#ods-#{format "%02d", n:}" } }
+ let(:objective_ids) { [*1..17].map! { |n| "#objective_#{format "%02d", n:}" } }
before do
switch_to_host(organization.host)
end
@@ -23,7 +20,7 @@
end
it "shows the list of all SDGs" do
- expect(page).to have_selector(".ods", count: 18)
+ expect(page).to have_css(".ods", count: 18)
end
describe "ods logo click" do
diff --git a/spec/system/decidim/solutions/admin/manage_solutions_spec.rb b/spec/system/decidim/solutions/admin/manage_solutions_spec.rb
index 34171652..4986c594 100644
--- a/spec/system/decidim/solutions/admin/manage_solutions_spec.rb
+++ b/spec/system/decidim/solutions/admin/manage_solutions_spec.rb
@@ -2,11 +2,12 @@
require "spec_helper"
-describe "Admin creates solutions", type: :system do
+# rubocop:disable Capybara/SpecificMatcher
+describe "Admin creates solutions" do
let(:manifest_name) { "solutions" }
let(:organization) { participatory_process.organization }
- let!(:user) { create :user, :admin, :confirmed, organization: organization }
- let!(:solution) { create :solution, component: component }
+ let!(:user) { create(:user, :admin, :confirmed, organization:) }
+ let!(:solution) { create(:solution, component:) }
include_context "when managing a component as an admin"
@@ -15,10 +16,8 @@
visit_component_admin
find("a.button", text: "New solution").click
- within(".card-title", match: :first) do
- expect(page).to have_content organization.name
- end
expect(page).to have_css "input#solution_title_en"
end
end
end
+# rubocop:enable Capybara/SpecificMatcher
diff --git a/spec/system/decidim/solutions/filter_solutions_spec.rb b/spec/system/decidim/solutions/filter_solutions_spec.rb
index c39e956a..de9f8057 100644
--- a/spec/system/decidim/solutions/filter_solutions_spec.rb
+++ b/spec/system/decidim/solutions/filter_solutions_spec.rb
@@ -3,132 +3,94 @@
require "spec_helper"
require_relative "../filter_resources_by_scope_examples"
-describe "Filter Solutions", :slow, type: :system do
+describe "Filter Solutions", :slow do
include_context "with a component"
let(:manifest_name) { "solutions" }
- let!(:category) { create :category, participatory_space: participatory_process }
- let!(:scope) { create :scope, organization: organization }
- let!(:user) { create :user, :confirmed, organization: organization }
- let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization: organization, scope: scope) }
+ let!(:scope) { create(:scope, organization:) }
+ let!(:user) { create(:user, :confirmed, organization:) }
+ let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization:, scope:) }
describe "when filtering solutions by challenge's territorial scopes" do
before do
challenges_component = create(:challenges_component, participatory_space: participatory_process)
problems_component = create(:problems_component, participatory_space: participatory_process)
- challenge = create(:challenge, component: challenges_component, scope: scope)
- problem = create(:problem, component: problems_component, challenge: challenge)
- create_list(:solution, 2, component: component, problem: problem)
+ challenge = create(:challenge, component: challenges_component, scope:)
+ problem = create(:problem, component: problems_component, challenge:)
+ create_list(:solution, 2, component:, problem:)
challenge_2 = create(:challenge, component: challenges_component, scope: scope_2)
problem_2 = create(:problem, component: problems_component, challenge: challenge_2)
- create(:solution, component: component, problem: problem_2)
+ create(:solution, component:, problem: problem_2)
challenge_no_scope = create(:challenge, component: challenges_component, scope: nil)
problem_no_scope = create(:problem, component: problems_component, challenge: challenge_no_scope)
- create(:solution, component: component, problem: problem_no_scope)
+ create(:solution, component:, problem: problem_no_scope)
end
- include_examples "when filtering resources by a scope", "SOLUTION", ".card--solution", ".with_any_territorial_scope_id_check_boxes_tree_filter"
+ include_examples "when filtering resources by a scope", "Territorial scope", ".card__list"
end
- describe "when filtering solutions by SDG" do
- context "when the participatory_space does NOT contain an SDGs component" do
- before do
- visit_component
- end
-
- it "the filter is not rendered" do
- expect(page).not_to have_css(".filters__section.sdgs-filter")
- end
- end
+ # describe "when filtering solutions by SDG" do
+ # context "when the participatory_space does NOT contain an SDGs component" do
+ # before do
+ # visit_component
+ # end
- context "when the participatory_space DOES contain an SDGs component" do
- let!(:sdgs_component) { create(:sdgs_component, participatory_space: participatory_process) }
- let!(:challenges_component) { create(:challenges_component, participatory_space: participatory_process) }
- let!(:problems_component) { create(:problems_component, participatory_space: participatory_process) }
-
- before do
- challenge = create(:challenge, component: challenges_component, sdg_code: :no_poverty)
- problem = create(:problem, component: problems_component, challenge: challenge)
- create_list(:solution, 2, component: component, problem: problem, challenge: challenge)
- challenge = create(:challenge, component: challenges_component, sdg_code: :zero_hunger)
- problem = create(:problem, component: problems_component, challenge: challenge)
- create(:solution, component: component, problem: problem, challenge: challenge)
- challenge = create(:challenge, component: challenges_component, sdg_code: :good_health)
- problem = create(:problem, component: problems_component, challenge: challenge)
- create(:solution, component: component, problem: problem, challenge: challenge)
- challenge = create(:challenge, component: challenges_component)
- problem = create(:problem, component: problems_component, challenge: challenge)
- create(:solution, component: component, problem: problem, challenge: challenge)
- visit_component
- end
-
- it "the filter is rendered" do
- expect(page).to have_css(".filters__section.sdgs-filter")
- end
-
- context "when NOT selecting any SDG" do
- it "lists all the solutions" do
- expect(page).to have_css(".card--solution", count: 5)
- expect(page).to have_content("5 SOLUTIONS")
- end
- end
-
- context "when selecting some SDGs" do
- before do
- find(".filters__section.sdgs-filter button").click
- expect(page).to have_css("#sdgs-modal")
-
- within "#sdgs-modal" do
- find('.sdg-cell[data-value="no_poverty"]').click
- find('.sdg-cell[data-value="good_health"]').click
- find(".reveal__footer a.button").click
- end
- end
-
- it "lists the solutions with the selected SDGs" do
- expect(page).to have_css(".card--solution", count: 3)
- expect(page).to have_content("3 SOLUTIONS")
- end
- end
- end
- end
+ # it "the filter is not rendered" do
+ # expect(page).to have_no_css(".filters__section.sdgs-filter")
+ # end
+ # end
- # context "when filtering solutions by CATEGORY", :slow do
- # context "when the user is logged in" do
- # let!(:category2) { create :category, participatory_space: participatory_process }
- # let!(:category3) { create :category, participatory_space: participatory_process }
- # let!(:solution1) { create(:solution, component: component, category: category) }
- # let!(:solution2) { create(:solution, component: component, category: category2) }
- # let!(:solution3) { create(:solution, component: component, category: category3) }
+ # context "when the participatory_space DOES contain an SDGs component" do
+ # let!(:sdgs_component) { create(:sdgs_component, participatory_space: participatory_process) }
+ # let!(:challenges_component) { create(:challenges_component, participatory_space: participatory_process) }
+ # let!(:problems_component) { create(:problems_component, participatory_space: participatory_process) }
# before do
- # login_as user, scope: :user
+ # challenge = create(:challenge, component: challenges_component, sdg_code: :no_poverty)
+ # problem = create(:problem, component: problems_component, challenge:)
+ # create_list(:solution, 2, component:, problem:, challenge:)
+ # challenge = create(:challenge, component: challenges_component, sdg_code: :zero_hunger)
+ # problem = create(:problem, component: problems_component, challenge:)
+ # create(:solution, component:, problem:, challenge:)
+ # challenge = create(:challenge, component: challenges_component, sdg_code: :good_health)
+ # problem = create(:problem, component: problems_component, challenge:)
+ # create(:solution, component:, problem:, challenge:)
+ # challenge = create(:challenge, component: challenges_component)
+ # problem = create(:problem, component: problems_component, challenge:)
+ # create(:solution, component:, problem:, challenge:)
+ # visit_component
# end
- # it "can be filtered by a category" do
- # visit_component
+ # it "the filter is rendered" do
+ # expect(page).to have_field(".filters__section.sdgs-filter")
+ # end
- # within ".filters .category_id_check_boxes_tree_filter" do
- # uncheck "All"
- # check category.name[I18n.locale.to_s]
+ # context "when NOT selecting any SDG" do
+ # it "lists all the solutions" do
+ # expect(page).to have_field(".card--solution", count: 5)
+ # expect(page).to have_content("5 SOLUTIONS")
# end
-
- # expect(page).to have_css(".card--solution", count: 1)
# end
- # it "can be filtered by two categories" do
- # visit_component
+ # context "when selecting some SDGs" do
+ # before do
+ # find(".filters__section.sdgs-filter button").click_on
+ # expect(page).to have_field("#sdgs-modal")
- # within ".filters .category_id_check_boxes_tree_filter" do
- # uncheck "All"
- # check category.name[I18n.locale.to_s]
- # check category2.name[I18n.locale.to_s]
+ # within "#sdgs-modal" do
+ # find('.sdg-cell[data-value="no_poverty"]').click_on
+ # find('.sdg-cell[data-value="good_health"]').click_on
+ # find(".reveal__footer a.button").click_on
+ # end
# end
- # expect(page).to have_css(".card--solution", count: 2)
+ # it "lists the solutions with the selected SDGs" do
+ # expect(page).to have_field(".card--solution", count: 3)
+ # expect(page).to have_content("3 SOLUTIONS")
+ # end
# end
# end
# end
@@ -148,11 +110,11 @@
# check "Rejected"
# end
- # expect(page).to have_css(".card.card--solution", count: 8)
+ # expect(page).to have_field(".card.card--solution", count: 8)
# page.go_back
- # expect(page).to have_css(".card.card--solution", count: 6)
+ # expect(page).to have_field(".card.card--solution", count: 6)
# end
# it "recover filters from previous pages" do
@@ -172,19 +134,19 @@
# check "Accepted"
# end
- # expect(page).to have_css(".card.card--solution", count: 2)
+ # expect(page).to have_field(".card.card--solution", count: 2)
# page.go_back
- # expect(page).to have_css(".card.card--solution", count: 6)
+ # expect(page).to have_field(".card.card--solution", count: 6)
# page.go_back
- # expect(page).to have_css(".card.card--solution", count: 8)
+ # expect(page).to have_field(".card.card--solution", count: 8)
# page.go_forward
- # expect(page).to have_css(".card.card--solution", count: 6)
+ # expect(page).to have_field(".card.card--solution", count: 6)
# end
# end
end
diff --git a/spec/system/decidim/solutions/solutions_global_search_spec.rb b/spec/system/decidim/solutions/solutions_global_search_spec.rb
index 6834649b..c5d94808 100644
--- a/spec/system/decidim/solutions/solutions_global_search_spec.rb
+++ b/spec/system/decidim/solutions/solutions_global_search_spec.rb
@@ -2,10 +2,10 @@
require "spec_helper"
-describe "Solutions global search", type: :system do
+describe "Solutions global search" do
include_context "with a component"
let(:manifest_name) { "solutions" }
- let!(:searchables) { create_list(:solution, 3, component: component) }
+ let!(:searchables) { create_list(:solution, 3, component:) }
let!(:term) { translated(searchables.first.title).split.last }
before do
diff --git a/spec/system/decidim/solutions/solutions_spec.rb b/spec/system/decidim/solutions/solutions_spec.rb
index 48e86d78..3e460969 100644
--- a/spec/system/decidim/solutions/solutions_spec.rb
+++ b/spec/system/decidim/solutions/solutions_spec.rb
@@ -2,7 +2,7 @@
require "spec_helper"
-describe "Solutions", type: :system do
+describe "Solutions" do
include ActionView::Helpers::SanitizeHelper
include_context "with a component"
@@ -10,11 +10,11 @@
describe "#show" do
context "when a solution has contents" do
- let!(:solution) { create(:solution, component: component) }
+ let!(:solution) { create(:solution, component:) }
before do
visit_component
- click_link translated(solution.title)
+ click_on translated(solution.title)
end
it "does render the contents" do
@@ -34,20 +34,20 @@
end
context "when a solution optional contents are empty" do
- let!(:solution) { create(:solution, component: component, indicators: {}, beneficiaries: {}, requirements: {}, financing_type: {}, objectives: {}, tags: {}) }
+ let!(:solution) { create(:solution, component:, indicators: {}, beneficiaries: {}, requirements: {}, financing_type: {}, objectives: {}, tags: {}) }
before do
visit_component
- click_link translated(solution.title)
+ click_on translated(solution.title)
end
it "does not render titles for empty contents" do
- expect(page).not_to have_content("Indicators")
- expect(page).not_to have_content("Beneficiaries")
- expect(page).not_to have_content("Requeriments")
- expect(page).not_to have_content("FINANCING TYPE")
- expect(page).not_to have_content("Objectives")
- expect(page).not_to have_content("Keywords")
+ expect(page).to have_no_content("Indicators")
+ expect(page).to have_no_content("Beneficiaries")
+ expect(page).to have_no_content("Requeriments")
+ expect(page).to have_no_content("FINANCING TYPE")
+ expect(page).to have_no_content("Objectives")
+ expect(page).to have_no_content("Keywords")
end
end
end
@@ -55,40 +55,38 @@
describe("#index") do
context "when list solutions" do
let(:other_component) { create(:solutions_component) }
- let!(:older_solution) { create(:solution, component: component, created_at: 1.month.ago) }
- let!(:recent_solution) { create(:solution, component: component, created_at: Time.now.utc) }
+ let!(:older_solution) { create(:solution, component:, created_at: 1.month.ago) }
+ let!(:recent_solution) { create(:solution, component:, created_at: Time.now.utc) }
let!(:other_component_solution) { create(:solution, component: other_component, created_at: Time.now.utc) }
- let!(:solutions) { create_list(:solution, 2, component: component) }
+ let!(:solutions) { create_list(:solution, 2, component:) }
before do
visit_component
end
it "show only solutions of current component" do
- expect(page).to have_selector(".card--solution", count: 4)
+ expect(page).to have_css(".card__list", count: 4)
expect(page).to have_content(translated(solutions.first.title))
expect(page).to have_content(translated(solutions.last.title))
end
it "ordered randomly" do
within ".order-by" do
- expect(page).to have_selector("ul[data-dropdown-menu$=dropdown-menu]", text: "Random")
+ page.find("a", text: "Random").click
end
- expect(page).to have_selector(".card--solution", count: 4)
+ expect(page).to have_css(".card__list", count: 4)
expect(page).to have_content(translated(solutions.first.title))
expect(page).to have_content(translated(solutions.last.title))
end
it "ordered by created at" do
within ".order-by" do
- expect(page).to have_selector("ul[data-dropdown-menu$=dropdown-menu]", text: "Random")
- page.find("a", text: "Random").click
- click_link "Most recent"
+ page.find("a", text: "Most recent").click
end
- expect(page).to have_selector("#solutions .card-grid .column:first-child", text: recent_solution.title[:en])
- expect(page).to have_selector("#solutions .card-grid .column:last-child", text: older_solution.title[:en])
+ expect(page).to have_css(".order-by .button:first-child", text: recent_solution.title[:en])
+ expect(page).to have_css(".order-by .button:last-child", text: older_solution.title[:en])
end
end
end
diff --git a/spec/system/decidim/solutions/without_filters_solutions_spec.rb b/spec/system/decidim/solutions/without_filters_solutions_spec.rb
index 44ec0146..aee0d9ff 100644
--- a/spec/system/decidim/solutions/without_filters_solutions_spec.rb
+++ b/spec/system/decidim/solutions/without_filters_solutions_spec.rb
@@ -2,18 +2,17 @@
require "spec_helper"
-describe "Without filters Solutions", :slow, type: :system do
+describe "Without filters Solutions", :slow do
include_context "with a component"
let(:manifest_name) { "solutions" }
- let!(:category) { create :category, participatory_space: participatory_process }
- let!(:scope) { create :scope, organization: organization }
- let!(:user) { create :user, :confirmed, organization: organization }
- let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization: organization, scope: scope) }
+ let!(:scope) { create(:scope, organization:) }
+ let!(:user) { create(:user, :confirmed, organization:) }
+ let(:scoped_participatory_process) { create(:participatory_process, :with_steps, organization:, scope:) }
describe "when filters are hide" do
let(:scopes_picker) { select_data_picker(:filter_scope_id, multiple: true, global_value: "global") }
- let!(:scope_2) { create :scope, organization: participatory_process.organization }
+ let!(:scope_2) { create(:scope, organization: participatory_process.organization) }
before do
component.settings = { hide_filters: true }
@@ -22,27 +21,27 @@
challenges_component = create(:challenges_component, participatory_space: participatory_process)
problems_component = create(:problems_component, participatory_space: participatory_process)
- challenge = create(:challenge, component: challenges_component, scope: scope)
- problem = create(:problem, component: problems_component, challenge: challenge)
- create_list(:solution, 2, component: component, problem: problem)
+ challenge = create(:challenge, component: challenges_component, scope:)
+ problem = create(:problem, component: problems_component, challenge:)
+ create_list(:solution, 2, component:, problem:)
challenge_2 = create(:challenge, component: challenges_component, scope: scope_2)
problem_2 = create(:problem, component: problems_component, challenge: challenge_2)
- create(:solution, component: component, problem: problem_2)
+ create(:solution, component:, problem: problem_2)
challenge_no_scope = create(:challenge, component: challenges_component, scope: nil)
problem_no_scope = create(:problem, component: problems_component, challenge: challenge_no_scope)
- create(:solution, component: component, problem: problem_no_scope)
+ create(:solution, component:, problem: problem_no_scope)
visit_component
end
- it "show challenges in three columns" do
- expect(page).to have_css(".mediumlarge-11.large-12")
+ it "show solutions" do
+ expect(page).to have_css(".card__list")
end
it "not show filters" do
- expect(page).not_to have_css(".filters")
+ expect(page).to have_no_css(".filters")
end
end
end
diff --git a/spec/types/problem_type_spec.rb b/spec/types/problem_type_spec.rb
index 7e527be0..8ce9e6fd 100644
--- a/spec/types/problem_type_spec.rb
+++ b/spec/types/problem_type_spec.rb
@@ -13,7 +13,7 @@ module Problems
let(:technological_scope) { create(:scope, organization: model.participatory_space.organization) }
before do
- model.update(sectorial_scope: sectorial_scope, technological_scope: technological_scope)
+ model.update(sectorial_scope:, technological_scope:)
end
describe "query" do