<%= t(@sdg + ".logo.line1", scope: "decidim.components.sdgs") %>
@@ -116,6 +86,7 @@
+ <%= resource_reference(current_participatory_space) %>
<%= render partial: "decidim/shared/follow_button", class: "text-center", locals: { followable: current_participatory_space, large: false } %>
<%= cell "decidim/share_button", nil %>
diff --git a/config/locales/ca.yml b/config/locales/ca.yml
index 52125e63..983ab704 100644
--- a/config/locales/ca.yml
+++ b/config/locales/ca.yml
@@ -153,11 +153,6 @@ ca:
search: Cerca
state: Estat
sdgs: SDGs
- filters_small_view:
- close_modal: Tancar finestra
- filter: Filtra
- filter_by: Filtra per
- unfold: Desplega
orders:
label: Ordenacions
random: Aleatori
@@ -1076,11 +1071,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
@@ -1235,11 +1225,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 b1e7baea..dce61fdc 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -127,11 +127,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ě
@@ -539,11 +534,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ě
@@ -664,11 +654,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 a67573e3..94d60bec 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -151,11 +151,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
@@ -1074,11 +1069,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
@@ -1232,11 +1222,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 53ab0c5d..465c1766 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -151,11 +151,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
@@ -1085,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
@@ -1243,11 +1233,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 7fe0187c..74dee6a2 100644
--- a/config/locales/oc.yml
+++ b/config/locales/oc.yml
@@ -151,11 +151,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
@@ -1070,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
@@ -1222,11 +1212,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/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/models/decidim/challenges/survey_spec.rb b/spec/models/decidim/challenges/survey_spec.rb
index 855780b3..e372cd24 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: challenge, user: 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: challenge, user: user)
end
it { is_expected.not_to be_valid }
diff --git a/spec/serializers/decidim/challenges/survey_serializer_spec.rb b/spec/serializers/decidim/challenges/survey_serializer_spec.rb
index 841600cb..1e61af59 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!(: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: question, user: 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: 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: 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: 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: 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..e9e34b9c 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: questionnaire) }
let!(:answers) do
questions.map do |question|
- create_list :answer, 3, questionnaire: questionnaire, question: question
+ create_list(:answer, 3, questionnaire: questionnaire, question: 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..eb01dabf 100644
--- a/spec/shared/manage_challenges_examples.rb
+++ b/spec/shared/manage_challenges_examples.rb
@@ -14,66 +14,61 @@
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)
within "#challenge-title-tabs" do
- click_link "Català"
+ click_on "Català"
end
expect(page).to have_css("input", 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)
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)
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)
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)
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)
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)
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)
end
end
context "when there is only one locale" do
- let(:organization) { create :organization, available_locales: [:en] }
+ let(:organization) { create(:organization, available_locales: [:en]) }
let(:component) { create(:component, manifest_name: manifest_name, organization: organization) }
let!(:challenge) do
create(:challenge, scope: scope, component: component,
@@ -83,19 +78,19 @@
end
it "shows the title correctly" do
- expect(page).not_to have_css("#challenge-title-tabs")
+ expect(page).to have_no_css("#challenge-title-tabs")
expect(page).to have_css("input", 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_no_css("#challenge-description-tabs")
expect(page).to have_css("input", 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_questionnaires_answers_examples.rb b/spec/shared/manage_questionnaires_answers_examples.rb
index c3d24a88..40b811e5 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: 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: 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: questionnaire, question: first) }
+ let!(:answer_2) { create(:answer, body: "second answer", questionnaire: questionnaire, question: first) }
+ let!(:answer_3) { create(:answer, questionnaire: 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: 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..4f3e04e9 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"
@@ -60,19 +58,19 @@
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
@@ -100,7 +98,7 @@ def nested_form_field_selector(attribute)
def within_add_display_condition(&block)
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
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/system/decidim/challenges/challenge_surveys_spec.rb b/spec/system/decidim/challenges/challenge_surveys_spec.rb
index 3a1757a9..115e56ca 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!(:challenge) { create(:challenge, component: component, questionnaire: questionnaire) }
+ let!(:user) { create(:user, :confirmed, organization: organization) }
let(:survey_enabled) { true }
let(:survey_form_enabled) { false }
@@ -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
@@ -58,8 +58,8 @@ def questionnaire_public_path
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..030a4422 100644
--- a/spec/system/decidim/challenges/challenges_global_search_spec.rb
+++ b/spec/system/decidim/challenges/challenges_global_search_spec.rb
@@ -2,7 +2,7 @@
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) }
diff --git a/spec/system/decidim/challenges/challenges_spec.rb b/spec/system/decidim/challenges/challenges_spec.rb
index 38761f86..1b1a521a 100644
--- a/spec/system/decidim/challenges/challenges_spec.rb
+++ b/spec/system/decidim/challenges/challenges_spec.rb
@@ -2,7 +2,7 @@
require "spec_helper"
-describe "Challenges", type: :system do
+describe "Challenges" do
include_context "with a component"
let(:manifest_name) { "challenges" }
@@ -12,20 +12,20 @@
context "when a challenge has contents" do
let!(:challenge) { create(:challenge, component: component) }
let(:problems_component) { create(:problems_component, participatory_space: challenge.participatory_space) }
- let(:problem) { create :problem, component: problems_component, challenge: challenge }
+ let!(:problem) { create(:problem, component: problems_component, challenge: challenge) }
let!(:solution) { create(:solution, component: solutions_component, problem: 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
@@ -35,13 +35,13 @@
before do
visit_component
- click_link translated(challenge.title)
+ click_on 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
@@ -59,30 +59,29 @@
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")
+ expect(page).to have_content("Random")
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"
+ click_on "Most recent"
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
@@ -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..13d843e0 100644
--- a/spec/system/decidim/challenges/filter_challenges_spec.rb
+++ b/spec/system/decidim/challenges/filter_challenges_spec.rb
@@ -2,18 +2,18 @@
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!(: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) }
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)
@@ -91,7 +91,7 @@
end
context "with subscopes" do
- let!(:subscopes) { create_list :subscope, 5, parent: scope }
+ let!(:subscopes) { create_list(:subscope, 5, parent: scope) }
it "can be filtered by scope" do
visit_component
@@ -157,7 +157,7 @@
end
it "the filter is not rendered" do
- expect(page).not_to have_css(".filters__section.sdgs-filter")
+ expect(page).to have_no_css(".filters__section.sdgs-filter")
end
end
@@ -230,7 +230,7 @@
page.find(".card--challenge .card__link").click
- click_link "Return to list"
+ click_on "Return to list"
expect(page).to have_css(".card--challenge", count: 1)
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..b442e5b0 100644
--- a/spec/system/decidim/challenges/without_filters_challenges_spec.rb
+++ b/spec/system/decidim/challenges/without_filters_challenges_spec.rb
@@ -2,18 +2,18 @@
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!(: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) }
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 }
@@ -24,12 +24,8 @@
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