diff --git a/Gemfile b/Gemfile index 5602833..7a2f79c 100644 --- a/Gemfile +++ b/Gemfile @@ -13,9 +13,8 @@ gem "decidim-conferences", "~> #{DECIDIM_VERSION}.0" # gem "acts_as_textcaptcha", "~> 4.5.1" gem "decidim-budgets_paper_ballots", git: "https://github.com/digidemlab/decidim-module-budgets_paper_ballots", branch: DECIDIM_BRANCH gem "decidim-decidim_awesome" -gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-custom-states" +gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals", branch: "release/0.26-stable" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" gem "decidim-spam_detection" @@ -28,6 +27,7 @@ gem "decidim-sms-twilio", github: "OpenSourcePolitics/decidim-module-ptp", branc # NOTE: Custom proposal states must be before simple_proposal gem "decidim-custom_proposal_states", git: "https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states", branch: DECIDIM_BRANCH +gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: "feat/budget_booth_0.26" gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "dotenv-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 6cfcd1d..7afa87a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: https://github.com/OpenSourcePolitics/decidim-module-half_sign_up - revision: a105c5815be7f1ca18cd827b5a475318ada08dfb - branch: release/0.26-stable + revision: 0d47520fe75c2f32ddf74bca0a468ba83dda6caf + branch: feat/budget_booth_0.26 specs: decidim-half_signup (0.26.0) countries (~> 5.1, >= 5.1.2) @@ -21,7 +21,7 @@ GIT GIT remote: https://github.com/OpenSourcePolitics/decidim-module-ptp.git - revision: 6148a817251256d6f536f1f3478c8be895a518b0 + revision: 0aa2d9a3fc9aee3279d9272a8347ca4d22cac728 branch: feature/0.26/zip-code-voting specs: decidim-budgets_booth (0.26.0) @@ -34,6 +34,14 @@ GIT countries (~> 5.1, >= 5.1.2) decidim-core (~> 0.26.0) +GIT + remote: https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals + revision: dc1a7211ae53f8aa94e70fc6b96604a6216f4fda + branch: release/0.26-stable + specs: + decidim-homepage_proposals (1.0.2) + decidim-core (~> 0.26) + GIT remote: https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler revision: 488cc8827845ec1c5266aa499df2ebf9b20e02a3 @@ -44,7 +52,7 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states - revision: 5e275e703cfb06230841e50b9498804d70a804f2 + revision: 97fe7d5577b193098dbf9e9a97e0ffaf2e74d34e branch: release/0.26-stable specs: decidim-custom_proposal_states (0.26.9) @@ -60,14 +68,6 @@ GIT decidim-slider (0.0.3) decidim-core (~> 0.26.0) -GIT - remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: da1159268ae3430150df8a3e5b174b2e5da2f33f - branch: release/0.26-custom-states - specs: - decidim-homepage_proposals (1.0.2) - decidim-core (~> 0.26) - GIT remote: https://github.com/digidemlab/decidim-module-budgets_paper_ballots revision: 3e5d2794f43b1c353e8a3116edf6daab9e3a26a7 @@ -175,16 +175,16 @@ GEM public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) aws-eventstream (1.3.0) - aws-partitions (1.884.0) - aws-sdk-core (3.191.0) + aws-partitions (1.911.0) + aws-sdk-core (3.191.6) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.77.0) + aws-sdk-kms (1.78.0) aws-sdk-core (~> 3, >= 3.191.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.143.0) + aws-sdk-s3 (1.146.1) aws-sdk-core (~> 3, >= 3.191.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.8) @@ -212,9 +212,9 @@ GEM html_tokenizer (~> 0.0.6) parser (>= 2.4) smart_properties - bigdecimal (3.1.6) + bigdecimal (3.1.7) bindex (0.8.1) - bootsnap (1.17.1) + bootsnap (1.18.3) msgpack (~> 1.2) brakeman (5.4.1) browser (2.7.1) @@ -229,7 +229,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - carrierwave (2.2.5) + carrierwave (2.2.6) activemodel (>= 5.0.0) activesupport (>= 5.0.0) addressable (~> 2.6) @@ -249,7 +249,7 @@ GEM actionpack (>= 5.0) cells (>= 4.1.6, < 5.0.0) charlock_holmes (0.7.7) - chef-utils (18.3.0) + chef-utils (18.4.12) concurrent-ruby childprocess (3.0.0) coercible (1.0.0) @@ -263,16 +263,15 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.2.3) connection_pool (2.4.1) - countries (5.7.1) + countries (5.7.2) unaccent (~> 0.3) - crack (0.4.6) + crack (1.0.0) bigdecimal rexml crass (1.0.6) - css_parser (1.16.0) + css_parser (1.17.1) addressable - dalli (3.2.7) - base64 + dalli (3.2.8) date (3.3.4) date_validator (0.9.0) activemodel @@ -472,7 +471,7 @@ GEM rainbow (>= 2.1.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.9.3) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -483,13 +482,13 @@ GEM devise_invitable (2.0.9) actionmailer (>= 5.0) devise (>= 4.6) - diff-lcs (1.5.0) + diff-lcs (1.5.1) diffy (3.4.2) - doc2text (0.4.6) - nokogiri (>= 1.13.2, < 1.15.0) + doc2text (0.4.7) + nokogiri (>= 1.13.2, < 1.17.0) rubyzip (~> 2.3.0) docile (1.4.0) - doorkeeper (5.6.8) + doorkeeper (5.6.9) railties (>= 5) doorkeeper-i18n (4.0.1) dotenv (2.8.1) @@ -509,9 +508,9 @@ GEM erbse (0.1.4) temple erubi (1.12.0) - et-orbi (1.2.7) + et-orbi (1.2.11) tzinfo - excon (0.109.0) + excon (0.110.0) execjs (2.9.1) factory_bot (4.11.1) activesupport (>= 3.0.0) @@ -529,7 +528,7 @@ GEM file_validators (2.3.0) activemodel (>= 3.2) mime-types (>= 1.0) - fog-aws (3.21.0) + fog-aws (3.22.0) fog-core (~> 2.1) fog-json (~> 1.1) fog-xml (~> 0.1) @@ -547,7 +546,7 @@ GEM fog-core nokogiri (>= 1.5.11, < 2.0.0) formatador (1.1.0) - fugit (1.9.0) + fugit (1.10.1) et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) geocoder (1.7.5) @@ -558,9 +557,9 @@ GEM hashie (5.0.0) highline (2.1.0) hiredis (0.6.3) - html_tokenizer (0.0.7) + html_tokenizer (0.0.8) htmlentities (4.3.4) - i18n (1.14.1) + i18n (1.14.4) concurrent-ruby (~> 1.0) i18n-tasks (0.9.37) activesupport (>= 4.0.2) @@ -582,7 +581,7 @@ GEM invisible_captcha (0.13.0) rails (>= 3.2.0) jmespath (1.6.2) - json (2.7.1) + json (2.7.2) jwt (2.5.0) kaminari (1.2.2) activesupport (>= 4.1.0) @@ -602,13 +601,13 @@ GEM kramdown (~> 2.0) launchy (2.5.2) addressable (~> 2.8) - letter_opener (1.8.1) - launchy (>= 2.2, < 3) + letter_opener (1.10.0) + launchy (>= 2.2, < 4) letter_opener_web (1.4.1) actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - listen (3.8.0) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) lograge (0.14.0) @@ -624,7 +623,7 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) mdl (0.13.0) kramdown (~> 2.3) @@ -635,11 +634,11 @@ GEM method_source (1.0.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2023.1205) + mime-types-data (3.2024.0305) mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.5) - minitest (5.21.2) + minitest (5.22.3) mixlib-cli (2.1.8) mixlib-config (3.0.27) tomlrb @@ -651,16 +650,16 @@ GEM mustache (1.1.1) net-http (0.4.1) uri - net-imap (0.3.4) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) + nio4r (2.7.1) nokogiri (1.13.4) mini_portile2 (~> 2.8.0) racc (~> 1.4) @@ -683,11 +682,11 @@ GEM rack-protection omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (1.1.1) + omniauth-google-oauth2 (1.1.2) jwt (>= 2.0) - oauth2 (~> 2.0.6) + oauth2 (~> 2.0) omniauth (~> 2.0) - omniauth-oauth2 (~> 1.8.0) + omniauth-oauth2 (~> 1.8) omniauth-oauth (1.2.0) oauth omniauth (>= 1.0, < 3) @@ -727,12 +726,12 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - public_suffix (5.0.4) + public_suffix (5.0.5) puma (5.6.8) nio4r (~> 2.0) raabro (1.4.0) racc (1.7.3) - rack (2.2.8) + rack (2.2.9) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (1.1.1) @@ -779,7 +778,7 @@ GEM rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) ransack (2.4.2) activerecord (>= 5.2.4) activesupport (>= 5.2.4) @@ -795,7 +794,7 @@ GEM wisper (>= 1.6.1) redcarpet (3.6.0) redis (4.8.1) - redis-client (0.19.1) + redis-client (0.21.1) connection_pool redlock (2.0.6) redis-client (>= 0.14.1, < 1.0.0) @@ -810,24 +809,24 @@ GEM rgeo (2.4.0) rgeo-proj4 (3.1.1) rgeo (~> 2.0) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) rspec-cells (0.3.9) cells (>= 4.0.0, < 6.0.0) rspec-rails (>= 3.0.0, < 6.2.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) + rspec-support (~> 3.13.0) rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.12.6) + rspec-mocks (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) + rspec-support (~> 3.13.0) rspec-rails (4.1.2) actionpack (>= 4.2) activesupport (>= 4.2) @@ -838,7 +837,7 @@ GEM rspec-support (~> 3.10) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.12.1) + rspec-support (3.13.1) rspec_junit_formatter (0.3.0) rspec-core (>= 2, < 4, != 2.12.0) rubocop (0.92.0) @@ -850,8 +849,8 @@ GEM rubocop-ast (>= 0.5.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.30.0) - parser (>= 3.2.1.0) + rubocop-ast (1.31.2) + parser (>= 3.3.0.4) rubocop-faker (1.1.0) faker (>= 2.12.0) rubocop (>= 0.82.0) @@ -865,10 +864,10 @@ GEM ruby-saml (1.14.0) nokogiri (>= 1.10.5) rexml - ruby-vips (2.2.0) + ruby-vips (2.2.1) ffi (~> 1.12) ruby2_keywords (0.0.5) - rubyXL (3.4.25) + rubyXL (3.4.26) nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) @@ -881,13 +880,14 @@ GEM childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) semantic_range (3.0.0) - sentry-rails (5.16.1) + sentry-rails (5.17.2) railties (>= 5.0) - sentry-ruby (~> 5.16.1) - sentry-ruby (5.16.1) + sentry-ruby (~> 5.17.2) + sentry-ruby (5.17.2) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - sentry-sidekiq (5.16.1) - sentry-ruby (~> 5.16.1) + sentry-sidekiq (5.17.2) + sentry-ruby (~> 5.17.2) sidekiq (>= 3.0) seven_zip_ruby (1.3.0) sidekiq (6.5.12) @@ -929,7 +929,7 @@ GEM temple (0.10.3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.3.0) + thor (1.3.1) thread_safe (0.3.6) tilt (2.3.0) timeout (0.4.1) @@ -949,7 +949,7 @@ GEM valid_email2 (2.3.1) activemodel (>= 3.2) mail (~> 2.5) - version_gem (1.1.3) + version_gem (1.1.4) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -970,7 +970,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.19.1) + webmock (3.23.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -982,14 +982,14 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - wicked_pdf (2.7.0) + wicked_pdf (2.8.0) activesupport wisper (2.0.1) wisper-rspec (1.1.0) wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.12) + zeitwerk (2.6.13) PLATFORMS ruby @@ -1052,4 +1052,4 @@ RUBY VERSION ruby 2.7.7p221 BUNDLED WITH - 2.4.22 + 2.4.9 diff --git a/config/initializers/half_signup.rb b/config/initializers/half_signup.rb index 602439a..c97e675 100644 --- a/config/initializers/half_signup.rb +++ b/config/initializers/half_signup.rb @@ -1,5 +1,12 @@ # frozen_string_literal: true Decidim::HalfSignup.configure do |config| + # change this to false, if you don't want to redirect the user to the tos agreement page config.show_tos_page_after_signup = Rails.application.secrets.dig(:decidim, :module, :half_signup, :show_tos_page_after_signup) + + config.auth_code_length = 4 + # change this to other values if you want to change the length of generated code (be advised to remain in an acceptable limits for the sake of best performance) + + config.default_countries = [:us] + # change ':us' to the country/countries you want to be shown at the top(the first option will be selected by default). end diff --git a/spec/system/voting_index_page_spec.rb b/spec/system/voting_index_page_spec.rb deleted file mode 100644 index 60f25da..0000000 --- a/spec/system/voting_index_page_spec.rb +++ /dev/null @@ -1,323 +0,0 @@ -# frozen_string_literal: true - -# Overriding : https://github.com/Pipeline-to-Power/decidim-module-ptp/blob/main/decidim-budgets_booth/spec/system/voting_index_page_spec.rb -require "spec_helper" - -describe "Voting index page", type: :system do - include_context "with scoped budgets" - - let(:projects_count) { 10 } - let(:decidim_budgets) { Decidim::EngineRouter.main_proxy(component) } - let(:user) { create(:user, :confirmed, organization: organization) } - let(:first_budget) { budgets.first } - let(:second_budget) { budgets.second } - let(:active_step_id) { component.participatory_space.active_step.id } - - before do - switch_to_host(organization.host) - end - - context "when not signed in" do - before do - component.update(settings: component_settings.merge(workflow: "zip_code")) - visit_budget(first_budget) - end - - it_behaves_like "ensure user sign in" - end - - context "when no user_data" do - before do - component.update(settings: component_settings.merge(workflow: "zip_code")) - sign_in user, scope: :user - visit_budget(first_budget) - end - - it_behaves_like "ensure user data" - end - - context "when not allowed to vote that budget" do - let!(:user_data) { create(:user_data, component: component, user: user) } - - before do - component.update(settings: component_settings.merge(workflow: "zip_code")) - sign_in user, scope: :user - visit_budget(first_budget) - end - - it_behaves_like "not allowable voting" - end - - context "when voted to that budget" do - let!(:user_data) { create(:user_data, component: component, user: user) } - let!(:order) { create(:order, :with_projects, user: user, budget: first_budget) } - - before do - component.update(settings: component_settings.merge(workflow: "zip_code")) - order.update!(checked_out_at: Time.current) - user_data.update!(metadata: { zip_code: "10004" }) - sign_in user, scope: :user - visit_budget(first_budget) - end - - it "redirects the user" do - expect(page).to have_current_path("/") - within_flash_messages do - expect(page).to have_content "You are not allowed to perform this action." - end - end - end - - describe "voting" do - let!(:user_data) { create(:user_data, component: component, user: user) } - - before do - component.update(settings: component_settings.merge(workflow: "zip_code", projects_per_page: 5)) - user_data.update!(metadata: { zip_code: "10004" }) - sign_in user, scope: :user - visit_budget(first_budget) - end - - it "renders the page correctly" do - expect(page).to have_content("You are now in the voting booth.") - expect(page).to have_button("Cancel voting") - expect(page).to have_content("TOTAL BUDGET $100,000") - expect(page).to have_content("10 PROJECTS") - expect(page).to have_selector("button", text: "Read more", count: 5) - expect(page).to have_selector("button", text: "Add to your vote", count: 5) - end - - describe "budget summary" do - before do - click_button "Add to your vote", match: :first - end - - it "updates budget summary" do - within ".budget-summary__total" do - expect(page).to have_content("TOTAL BUDGET $100,000") - end - expect(page).to have_content("ASSIGNED: $25,000") - within "#order-selected-projects" do - expect(page).to have_content "1 project selected" - end - within ".progress.budget-progress" do - expect(page).to have_css(".progress-meter-text.progress-meter-text--right", match: :first, text: "25%") - end - within page.all(".budget-list .budget-list__item")[1] do - click_button "Read more" - end - within ".reveal-overlay" do - click_button "Add to your vote" - end - page.find(".close-button").click - expect(page).to have_content("ASSIGNED: $50,000") - within "#order-selected-projects" do - expect(page).to have_content "2 projects selected" - end - within ".progress.budget-progress" do - expect(page).to have_css(".progress-meter-text.progress-meter-text--right", match: :first, text: "50%") - end - click_link "2" - click_button "Add to your vote", match: :first - expect(page).to have_content("ASSIGNED: $75,000") - within "#order-selected-projects" do - expect(page).to have_content "3 projects selected" - end - - within page.all(".budget-list .budget-list__item")[0] do - click_button "Read more" - end - within ".reveal-overlay" do - click_button "Remove from vote" - end - expect(page).to have_content("ASSIGNED: $50,000") - within "#order-selected-projects" do - expect(page).to have_content "2 projects selected" - end - end - end - - it "paginates the projects" do - expect(page).to have_css(".budget-list .budget-list__item", count: 5) - find("li.page", text: "2").click - expect(page).to have_css(".budget-list .budget-list__item", count: 5) - end - - it "adds and removes projects" do - expect(page).to have_button("Add to your vote", count: 5) - click_button("Add to your vote", match: :first) - expect(page).to have_button("Add to your vote", count: 4) - expect(page).to have_button("Remove from vote", count: 1) - - within page.all(".budget-list .budget-list__item")[0] do - header = page.all("button")[0].text - click_button "Read more" - expect(page).to have_content(header) - expect(page).to have_button("Remove from vote") - end - within ".reveal-overlay" do - click_button "Remove from vote" - expect(page).to have_button("Add to your vote", count: 1) - end - end - - it "does not display filters" do - expect(page).not_to have_css(".new_filter") - end - - describe "#vote_success_content" do - before do - first_budget.update!(total_budget: 26_000) - end - - context "when vote_success_content is not set" do - before do - visit current_path - vote_budget! - end - - it "does not show the success message by default" do - expect(page).to have_no_selector("#thanks-message") - expect(page).to have_current_path(decidim_budgets.budgets_path) - end - end - - context "when vote success is set" do - before do - component.update!(settings: component_settings.merge(workflow: "zip_code", vote_success_content: { en: "

Some dummy text

" })) - visit current_path - vote_budget! - end - - it "shows the success message set" do - expect(page).to have_selector("#thanks-message") - within "#thanks-message" do - expect(page).to have_content("Thank you for voting!") - expect(page).to have_selector("p", text: "Some dummy text") - end - expect(page).to have_current_path(decidim_budgets.budgets_path) - end - end - end - - describe "vote_complete_content" do - let!(:order) { create(:order, user: user, budget: second_budget) } - - before do - first_budget.update!(total_budget: 26_000) - second_budget.update!(total_budget: 26_000) - order.checked_out_at = Time.current - order.projects << second_budget.projects.first - order.save! - end - - context "when not set" do - before do - visit current_path - vote_budget! - end - - it "does not show the modal" do - expect(page).to have_no_selector("#vote-completed") - expect(page).to have_current_path(decidim_budgets.budgets_path) - end - end - - context "when was set" do - before do - component.update!(settings: component_settings.merge(workflow: "zip_code", vote_completed_content: { en: "

Completed voting dummy text

" })) - visit current_path - vote_budget! - end - - it "shows the modal" do - expect(page).to have_selector("#vote-completed") - within "#vote-completed" do - expect(page).to have_content("You successfully completed your votes") - expect(page).to have_content("Completed voting dummy text") - end - expect(page).to have_current_path(decidim_budgets.budgets_path) - end - end - end - - context "when casting vote" do - before do - first_budget.update!(total_budget: 26_000) - visit current_path - click_button("Add to your vote", match: :first) - click_button "Vote" - end - - it "renders the info" do - within "#budget-confirm" do - expect(page).to have_content("These are the projects you have chosen to be part of the budget.") - expect(page).to have_selector("li", text: "$25,000", count: 1) - expect(page).to have_button("Confirm") - expect(page).to have_button("Cancel") - click_button("Cancel") - end - expect(page).to have_current_path(decidim_budgets.budget_voting_index_path(first_budget)) - end - end - - describe "#show_full_description_on_listing_page" do - let(:projects_count) { 1 } - let(:project) { first_budget.projects.first } - - before do - project.update!(description: Decidim::Faker::Localized.sentence(word_count: 20)) - end - - context "when not set" do - before do - visit current_path - end - - it "does not shows complete description by default" do - within("#project-#{project.id}-item") do - expect(page).to have_selector("button", text: translated(project.title)) - expect(page).to have_button("Read more") - expect(page).to have_content(/.*\.{3}$/) - end - end - end - - context "when set" do - before do - component.update!(settings: component_settings.merge(workflow: "zip_code", show_full_description_on_listing_page: true)) - visit current_path - end - - it "does not shows complete description by default" do - within("#project-#{project.id}-item") do - expect(page).to have_no_selector("button", text: translated(project.title)) - expect(page).to have_no_button("Read more") - expect(page).to have_no_content(/.*\.{3}$/) - expect(page).to have_content(translated(project.description)) - end - end - end - end - end - - private - - def decidim_budgets - Decidim::EngineRouter.main_proxy(component) - end - - def budget_path(budget) - decidim_budgets.budget_path(budget.id) - end - - def visit_budget(budget) - visit decidim_budgets.budget_voting_index_path(budget) - end - - def vote_budget! - click_button("Add to your vote", match: :first) - click_button "Vote" - click_button "Confirm" - end -end