diff --git a/app/controllers/legislation/proposals_controller.rb b/app/controllers/legislation/proposals_controller.rb index 4da2cb62146..944a4f6aa7a 100644 --- a/app/controllers/legislation/proposals_controller.rb +++ b/app/controllers/legislation/proposals_controller.rb @@ -53,7 +53,7 @@ def vote def proposal_params params.require(:legislation_proposal).permit(:legislation_process_id, :title, - :question, :summary, :description, :video_url, :tag_list, + :summary, :description, :video_url, :tag_list, :terms_of_service, :geozone_id, image_attributes: image_attributes, documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id]) diff --git a/app/controllers/management/proposals_controller.rb b/app/controllers/management/proposals_controller.rb index 2c497299a58..f24e9430307 100644 --- a/app/controllers/management/proposals_controller.rb +++ b/app/controllers/management/proposals_controller.rb @@ -52,9 +52,9 @@ def set_proposal end def proposal_params - params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, - :video_url, :responsible_name, :tag_list, :terms_of_service, - :geozone_id, :skip_map, + params.require(:proposal).permit(:title, :summary, :description, :video_url, + :responsible_name, :tag_list, :terms_of_service, :geozone_id, + :skip_map, map_location_attributes: [:latitude, :longitude, :zoom]) end diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb index 4372ecc63ea..5cc9b7e10fe 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -96,8 +96,8 @@ def publish private def proposal_params - params.require(:proposal).permit(:title, :question, :summary, :description, :external_url, - :video_url, :responsible_name, :tag_list, :terms_of_service, + params.require(:proposal).permit(:title, :summary, :description, :video_url, + :responsible_name, :tag_list, :terms_of_service, :geozone_id, :skip_map, image_attributes: image_attributes, documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy], diff --git a/app/models/legislation/proposal.rb b/app/models/legislation/proposal.rb index 16ab2d7dd98..d6fdf5eb31f 100644 --- a/app/models/legislation/proposal.rb +++ b/app/models/legislation/proposal.rb @@ -60,7 +60,6 @@ def to_param def searchable_values { title => "A", - question => "B", author.username => "B", tag_list.join(" ") => "B", geozone.try(:name) => "B", diff --git a/app/models/proposal.rb b/app/models/proposal.rb index dd72d517329..dfc81e2ea7d 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -38,14 +38,12 @@ class Proposal < ApplicationRecord has_many :polls, as: :related validates :title, presence: true - validates :question, presence: true validates :summary, presence: true validates :author, presence: true validates :responsible_name, presence: true, unless: :skip_user_verification? validates :title, length: { in: 4..Proposal.title_max_length } validates :description, length: { maximum: Proposal.description_max_length } - validates :question, length: { in: 10..Proposal.question_max_length } validates :responsible_name, length: { in: 6..Proposal.responsible_name_max_length }, unless: :skip_user_verification? validates :retired_reason, inclusion: { in: RETIRE_OPTIONS, allow_nil: true } @@ -117,7 +115,6 @@ def to_param def searchable_values { title => "A", - question => "B", author.username => "B", tag_list.join(" ") => "B", geozone.try(:name) => "B", diff --git a/app/views/admin/hidden_proposals/index.html.erb b/app/views/admin/hidden_proposals/index.html.erb index c0af9bc596e..4e23b8c5b3d 100644 --- a/app/views/admin/hidden_proposals/index.html.erb +++ b/app/views/admin/hidden_proposals/index.html.erb @@ -22,13 +22,9 @@
<%= proposal.summary %>
<%= proposal.description %> - <% if proposal.external_url.present? %> -<%= text_with_links proposal.external_url %>
- <% end %> <% if proposal.video_url.present? %><%= text_with_links proposal.video_url %>
<% end %> -<%= proposal.question %>
<%= proposal.summary %>
- <%= proposal.question %>
- <%= t("proposals.show.title_external_url") %> + <%= t("documents.additional") %>
<%= render partial: "documents/additional_document", collection: documents, as: :document %>- - <%= t("proposals.show.title_external_url") %> -
- <%= text_with_links @proposal.external_url %> -@@ -80,8 +70,6 @@ <% end %> -
- <%= t("proposals.form.proposal_question_example_html") %> -
- <%= f.text_field :question, maxlength: Proposal.question_max_length, - placeholder: t("proposals.form.proposal_question"), - label: false, - aria: {describedby: "question-help-text"} %> -<%= t("proposals.form.proposal_summary_note") %>
@@ -41,11 +30,6 @@ aria: {describedby: "video-url-help-text"} %>- - <%= t("proposals.show.title_external_url") %> -
- <%= text_with_links @proposal.external_url %> -@@ -62,10 +52,6 @@
#{Faker::Lorem.paragraphs.join("
")}
" proposal = Proposal.create!(author: author, title: Faker::Lorem.sentence(3).truncate(60), - question: Faker::Lorem.sentence(3) + "?", summary: Faker::Lorem.sentence(3), responsible_name: Faker::Name.name, - external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), tag_list: tags.sample(3).join(","), @@ -51,10 +49,8 @@ def add_image_to(imageable) months_to_archive_proposals = Setting["months_to_archive_proposals"] proposal = Proposal.create!(author: author, title: Faker::Lorem.sentence(3).truncate(60), - question: Faker::Lorem.sentence(3) + "?", summary: Faker::Lorem.sentence(3), responsible_name: Faker::Name.name, - external_url: Faker::Internet.url, description: description, tag_list: tags.sample(3).join(","), geozone: Geozone.all.sample, @@ -73,10 +69,8 @@ def add_image_to(imageable) description = "#{Faker::Lorem.paragraphs.join("
")}
" proposal = Proposal.create!(author: author, title: Faker::Lorem.sentence(3).truncate(60), - question: Faker::Lorem.sentence(3) + "?", summary: Faker::Lorem.sentence(3), responsible_name: Faker::Name.name, - external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), tag_list: tags.sample(3).join(","), @@ -94,10 +88,8 @@ def add_image_to(imageable) description = "#{Faker::Lorem.paragraphs.join("
")}
" proposal = Proposal.create!(author: author, title: Faker::Lorem.sentence(4).truncate(60), - question: Faker::Lorem.sentence(6) + "?", summary: Faker::Lorem.sentence(3), responsible_name: Faker::Name.name, - external_url: Faker::Internet.url, description: description, created_at: rand((Time.current - 1.week)..Time.current), tag_list: tags.sample(3).join(","), diff --git a/db/migrate/20190307165132_remove_question_and_external_url_from_proposals.rb b/db/migrate/20190307165132_remove_question_and_external_url_from_proposals.rb new file mode 100644 index 00000000000..42c6dbbbd5e --- /dev/null +++ b/db/migrate/20190307165132_remove_question_and_external_url_from_proposals.rb @@ -0,0 +1,6 @@ +class RemoveQuestionAndExternalUrlFromProposals < ActiveRecord::Migration + def change + remove_column :proposals, :question, :string + remove_column :proposals, :external_url, :string + end +end diff --git a/db/migrate/20190307165337_remove_question_and_external_url_from_legislation_proposals.rb b/db/migrate/20190307165337_remove_question_and_external_url_from_legislation_proposals.rb new file mode 100644 index 00000000000..f44f47a6548 --- /dev/null +++ b/db/migrate/20190307165337_remove_question_and_external_url_from_legislation_proposals.rb @@ -0,0 +1,6 @@ +class RemoveQuestionAndExternalUrlFromLegislationProposals < ActiveRecord::Migration + def change + remove_column :legislation_proposals, :question, :string + remove_column :legislation_proposals, :external_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 780a0cea63d..d8a3d9e6970 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -727,8 +727,6 @@ t.integer "legislation_process_id" t.string "title", limit: 80 t.text "description" - t.string "question" - t.string "external_url" t.integer "author_id" t.datetime "hidden_at" t.integer "flags_count", default: 0 @@ -1172,8 +1170,6 @@ create_table "proposals", force: :cascade do |t| t.string "title", limit: 80 t.text "description" - t.string "question" - t.string "external_url" t.integer "author_id" t.datetime "hidden_at" t.integer "flags_count", default: 0 @@ -1203,7 +1199,6 @@ t.index ["geozone_id"], name: "index_proposals_on_geozone_id", using: :btree t.index ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree t.index ["hot_score"], name: "index_proposals_on_hot_score", using: :btree - t.index ["question"], name: "index_proposals_on_question", using: :btree t.index ["summary"], name: "index_proposals_on_summary", using: :btree t.index ["title"], name: "index_proposals_on_title", using: :btree t.index ["tsv"], name: "index_proposals_on_tsv", using: :gin diff --git a/lib/tasks/proposal_actions.rake b/lib/tasks/proposal_actions.rake index fc914a8b5ca..f18d2f3a0ee 100644 --- a/lib/tasks/proposal_actions.rake +++ b/lib/tasks/proposal_actions.rake @@ -415,10 +415,8 @@ namespace :proposal_actions do description = "This is an example of a successful proposal with an ideal progress.
" proposal = Proposal.create!(author: author, title: Faker::Lorem.sentence(3).truncate(60), - question: Faker::Lorem.sentence(3) + "?", summary: Faker::Lorem.sentence(3), responsible_name: Faker::Name.name, - external_url: Faker::Internet.url, description: description, created_at: Time.now - expected_supports.length.days, tag_list: "Example", diff --git a/spec/factories/proposals.rb b/spec/factories/proposals.rb index 1b032755942..0821eb1684e 100644 --- a/spec/factories/proposals.rb +++ b/spec/factories/proposals.rb @@ -3,8 +3,6 @@ sequence(:title) { |n| "Proposal #{n} title" } sequence(:summary) { |n| "In summary, what we want is... #{n}" } description "Proposal description" - question "Proposal question" - external_url "http://external_documention.es" video_url "https://youtu.be/nhuNb0XtRhQ" responsible_name "John Snow" terms_of_service "1" diff --git a/spec/features/admin/hidden_proposals_spec.rb b/spec/features/admin/hidden_proposals_spec.rb index eb8c69b591c..724b8ffeac6 100644 --- a/spec/features/admin/hidden_proposals_spec.rb +++ b/spec/features/admin/hidden_proposals_spec.rb @@ -22,8 +22,6 @@ expect(page).to have_content(proposal.title) expect(page).to have_content(proposal.summary) expect(page).to have_content(proposal.description) - expect(page).to have_content(proposal.question) - expect(page).to have_content(proposal.external_url) expect(page).to have_content(proposal.video_url) end diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index 2966671d132..188fcf215d7 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -117,6 +117,10 @@ click_button "Save" expect(page).to have_content(proposal.title) + + visit admin_questions_path + + expect(page).to have_content(proposal.title) end scenario "Update" do diff --git a/spec/features/management/proposals_spec.rb b/spec/features/management/proposals_spec.rb index 03519d02d04..6e17e1dfc93 100644 --- a/spec/features/management/proposals_spec.rb +++ b/spec/features/management/proposals_spec.rb @@ -22,10 +22,8 @@ end fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yRYFKcMa_Ek" check "proposal_terms_of_service" @@ -34,10 +32,8 @@ expect(page).to have_content "Proposal created successfully." expect(page).to have_content "Help refugees" - expect(page).to have_content "¿Would you like to give assistance to war refugees?" expect(page).to have_content "In summary, what we want is..." expect(page).to have_content "This is very important because..." - expect(page).to have_content "http://rescue.org/refugees" expect(page).to have_content "https://www.youtube.com/watch?v=yRYFKcMa_Ek" expect(page).to have_content user.name expect(page).to have_content I18n.l(Proposal.last.created_at.to_date) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index a54884e4d87..c230a942263 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -125,9 +125,7 @@ expect(page).to have_content proposal.title expect(page).to have_content proposal.code - expect(page).to have_content "Proposal question" expect(page).to have_content "Proposal description" - expect(page).to have_content "http://external_documention.es" expect(page).to have_content proposal.author.name expect(page).to have_content I18n.l(proposal.created_at.to_date) expect(page).to have_selector(avatar(proposal.author.name)) @@ -219,10 +217,8 @@ visit new_proposal_path fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk" fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_tag_list", with: "Refugees, Solidarity" @@ -240,10 +236,8 @@ click_link "Not now, go to my proposal" expect(page).to have_content "Help refugees" - expect(page).to have_content "¿Would you like to give assistance to war refugees?" expect(page).to have_content "In summary, what we want is..." expect(page).to have_content "This is very important because..." - expect(page).to have_content "http://rescue.org/refugees" expect(page).to have_content "https://www.youtube.com/watch?v=yPQfcG-eimk" expect(page).to have_content author.name expect(page).to have_content "Refugees" @@ -258,10 +252,8 @@ visit new_proposal_path fill_in "proposal_title", with: "I am a bot" fill_in "proposal_subtitle", with: "This is the honeypot field" - fill_in "proposal_question", with: "This is a question" fill_in "proposal_summary", with: "This is the summary" fill_in "proposal_description", with: "This is the description" - fill_in "proposal_external_url", with: "http://google.com/robots.txt" fill_in "proposal_responsible_name", with: "Some other robot" check "proposal_terms_of_service" @@ -280,10 +272,8 @@ visit new_proposal_path fill_in "proposal_title", with: "I am a bot" - fill_in "proposal_question", with: "This is a question" fill_in "proposal_summary", with: "This is the summary" fill_in "proposal_description", with: "This is the description" - fill_in "proposal_external_url", with: "http://google.com/robots.txt" fill_in "proposal_responsible_name", with: "Some other robot" check "proposal_terms_of_service" @@ -300,10 +290,8 @@ visit new_proposal_path fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_responsible_name", with: "Isabel Garcia" fill_in "proposal_responsible_name", with: "Isabel Garcia" check "proposal_terms_of_service" @@ -325,10 +313,8 @@ expect(page).not_to have_selector("#proposal_responsible_name") fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" check "proposal_terms_of_service" click_button "Create proposal" @@ -355,10 +341,8 @@ visit new_proposal_path fill_in "proposal_title", with: "Testing an attack" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is
" - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_responsible_name", with: "Isabel Garcia" check "proposal_terms_of_service" @@ -380,7 +364,6 @@ visit new_proposal_path fill_in "proposal_title", with: "Testing auto link" - fill_in "proposal_question", with: "Should I stay or should I go?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is a link www.example.org
" fill_in "proposal_responsible_name", with: "Isabel Garcia" @@ -403,7 +386,6 @@ visit new_proposal_path fill_in "proposal_title", with: "Testing auto link" - fill_in "proposal_question", with: "Should I stay or should I go?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: js_injection_string fill_in "proposal_responsible_name", with: "Isabel Garcia" @@ -440,15 +422,7 @@ login_as(author) visit new_proposal_path - - fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" - fill_in "proposal_summary", with: "In summary, what we want is..." - fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" - fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk" - fill_in "proposal_responsible_name", with: "Isabel Garcia" - check "proposal_terms_of_service" + fill_in_proposal click_button "Create proposal" @@ -470,10 +444,8 @@ visit new_proposal_path fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk" fill_in "proposal_responsible_name", with: "Isabel Garcia" check "proposal_terms_of_service" @@ -629,10 +601,8 @@ expect(page).to have_current_path(edit_proposal_path(proposal)) fill_in "proposal_title", with: "End child poverty" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "Basically..." fill_in "proposal_description", with: "Let's do something to end child poverty" - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_responsible_name", with: "Isabel Garcia" click_button "Save changes" @@ -1833,9 +1803,7 @@ fill_in "proposal_title", with: "Help refugees" fill_in "proposal_summary", with: "In summary what we want is..." - fill_in "proposal_question", with: "Would you like to?" fill_in "proposal_description", with: "This is very important because..." - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk" fill_in "proposal_tag_list", with: "Refugees, Solidarity" check "proposal_terms_of_service" diff --git a/spec/features/tags/proposals_spec.rb b/spec/features/tags/proposals_spec.rb index eb330b79d22..a0e1cd6905c 100644 --- a/spec/features/tags/proposals_spec.rb +++ b/spec/features/tags/proposals_spec.rb @@ -70,7 +70,6 @@ visit new_proposal_path fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "This is very important because..." fill_in "proposal_responsible_name", with: "Isabel Garcia" @@ -97,10 +96,8 @@ visit new_proposal_path fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in_ckeditor "proposal_description", with: "A description with enough characters" - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=Ae6gQmhaMn4" fill_in "proposal_responsible_name", with: "Isabel Garcia" check "proposal_terms_of_service" @@ -142,10 +139,8 @@ visit new_proposal_path fill_in "proposal_title", with: "A test of dangerous strings" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." fill_in "proposal_description", with: "A description suitable for this test" - fill_in "proposal_external_url", with: "http://rescue.org/refugees" fill_in "proposal_responsible_name", with: "Isabel Garcia" check "proposal_terms_of_service" diff --git a/spec/lib/tasks/proposals_spec.rb b/spec/lib/tasks/proposals_spec.rb deleted file mode 100644 index fc464872d27..00000000000 --- a/spec/lib/tasks/proposals_spec.rb +++ /dev/null @@ -1,66 +0,0 @@ -require "rails_helper" - -describe Proposals do - - describe "Move external_url to description" do - - let :run_rake_task do - Rake::Task["proposals:move_external_url_to_description"].reenable - Rake.application.invoke_task "proposals:move_external_url_to_description" - end - - context "Move external_url to description for Proposals" do - - it "When proposal has external_url" do - proposal = create(:proposal, description: "Lorem ipsum dolor sit amet
", - external_url: "http://consul.dev") - - run_rake_task - proposal.reload - - expect(proposal.description).to eq "Lorem ipsum dolor sit amet
"\ - '" - expect(proposal.external_url).to eq "" - end - - it "When proposal has not external_url" do - proposal = create(:proposal, description: "Lorem ipsum dolor sit amet
", - external_url: "") - - run_rake_task - proposal.reload - - expect(proposal.description).to eq "Lorem ipsum dolor sit amet
" - expect(proposal.external_url).to eq "" - end - end - - context "Move external_url to description for Legislation proposals" do - - it "When legislation proposal has external_url" do - legislation_proposal = create(:legislation_proposal, description: "Ut enim ad minim
", - external_url: "http://consulproject.org") - run_rake_task - legislation_proposal.reload - - expect(legislation_proposal.description).to eq "Ut enim ad minim
"\ - ''\ - "http://consulproject.org
" - expect(legislation_proposal.external_url).to eq "" - end - - it "When legislation proposal has not external_url" do - legislation_proposal = create(:legislation_proposal, description: "Ut enim ad minim
", - external_url: "") - run_rake_task - legislation_proposal.reload - - expect(legislation_proposal.description).to eq "Ut enim ad minim
" - expect(legislation_proposal.external_url).to eq "" - end - end - end -end diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index 426e59e70cb..e9d31635022 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -54,23 +54,6 @@ end end - describe "#question" do - it "is not valid without a question" do - proposal.question = nil - expect(proposal).not_to be_valid - end - - it "is not valid when very short" do - proposal.question = "abc" - expect(proposal).not_to be_valid - end - - it "is not valid when very long" do - proposal.question = "a" * 141 - expect(proposal).not_to be_valid - end - end - describe "#video_url" do it "is not valid when URL is not from Youtube or Vimeo" do proposal.video_url = "https://twitter.com" @@ -491,12 +474,6 @@ expect(results).to eq([proposal]) end - it "searches by question" do - proposal = create(:proposal, question: "to be or not to be") - results = described_class.search("to be or not to be") - expect(results).to eq([proposal]) - end - it "searches by author name" do author = create(:user, username: "Danny Trejo") proposal = create(:proposal, author: author) @@ -575,7 +552,6 @@ context "order" do it "orders by weight" do - proposal_question = create(:proposal, question: "stop corruption") proposal_title = create(:proposal, title: "stop corruption") proposal_description = create(:proposal, description: "stop corruption") proposal_summary = create(:proposal, summary: "stop corruption") @@ -583,9 +559,8 @@ results = described_class.search("stop corruption") expect(results.first).to eq(proposal_title) - expect(results.second).to eq(proposal_question) - expect(results.third).to eq(proposal_summary) - expect(results.fourth).to eq(proposal_description) + expect(results.second).to eq(proposal_summary) + expect(results.third).to eq(proposal_description) end it "orders by weight and then by votes" do diff --git a/spec/shared/features/mappable.rb b/spec/shared/features/mappable.rb index ecbc5789b36..bce1071f35c 100644 --- a/spec/shared/features/mappable.rb +++ b/spec/shared/features/mappable.rb @@ -250,7 +250,6 @@ def do_login_for(user) def fill_in_proposal_form fill_in "proposal_title", with: "Help refugees" - fill_in "proposal_question", with: "¿Would you like to give assistance to war refugees?" fill_in "proposal_summary", with: "In summary, what we want is..." end diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb index b3febed10e3..e07b266803b 100644 --- a/spec/shared/features/nested_documentable.rb +++ b/spec/shared/features/nested_documentable.rb @@ -365,7 +365,6 @@ def expect_document_has_cached_attachment(index, extension) def documentable_fill_new_valid_proposal fill_in :proposal_title, with: "Proposal title #{rand(9999)}" fill_in :proposal_summary, with: "Proposal summary" - fill_in :proposal_question, with: "Proposal question?" check :proposal_terms_of_service end diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/features/nested_imageable.rb index a4a37adb23e..1e5d9ec34b6 100644 --- a/spec/shared/features/nested_imageable.rb +++ b/spec/shared/features/nested_imageable.rb @@ -291,7 +291,6 @@ def imageable_attach_new_file(_imageable_factory_name, path, success = true) def imageable_fill_new_valid_proposal fill_in :proposal_title, with: "Proposal title" fill_in :proposal_summary, with: "Proposal summary" - fill_in :proposal_question, with: "Proposal question?" check :proposal_terms_of_service end diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb index 118508119ab..efabd153213 100644 --- a/spec/support/common_actions.rb +++ b/spec/support/common_actions.rb @@ -26,6 +26,15 @@ def validate_officer to receive(:verify_officer_assignment).and_return(true) end + def fill_in_proposal + fill_in "proposal_title", with: "Help refugees" + fill_in "proposal_summary", with: "In summary what we want is..." + fill_in "proposal_description", with: "This is very important because..." + fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk" + fill_in "proposal_responsible_name", with: "Isabel Garcia" + check "proposal_terms_of_service" + end + def set_officing_booth(booth=nil) booth = create(:poll_booth) if booth.blank? diff --git a/spec/support/common_actions/proposals.rb b/spec/support/common_actions/proposals.rb index 93797935ba0..2ee198d148f 100644 --- a/spec/support/common_actions/proposals.rb +++ b/spec/support/common_actions/proposals.rb @@ -1,8 +1,8 @@ module Proposals def create_successful_proposals - [create(:proposal, title: "Winter is coming", question: "Do you speak it?", + [create(:proposal, title: "Winter is coming", cached_votes_up: Proposal.votes_needed_for_success + 100), - create(:proposal, title: "Fire and blood", question: "You talking to me?", + create(:proposal, title: "Fire and blood", cached_votes_up: Proposal.votes_needed_for_success + 1)] end