Remove all references to question and external_url fields

This commit is contained in:
decabeza
2019-04-30 16:42:07 +02:00
parent 4648906591
commit f40787561d
11 changed files with 10 additions and 64 deletions

View File

@@ -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 }

View File

@@ -10,17 +10,6 @@
<%= f.invisible_captcha :subtitle %>
<div class="small-12 column">
<%= f.label :question, t("proposals.form.proposal_question") %>
<p class="help-text" id="question-help-text">
<%= t("proposals.form.proposal_question_example_html") %>
</p>
<%= f.text_field :question, maxlength: Proposal.question_max_length,
placeholder: t("proposals.form.proposal_question"),
label: false,
aria: {describedby: "question-help-text"} %>
</div>
<div class="small-12 column">
<%= f.label :summary, t("proposals.form.proposal_summary") %>
<p class="help-text" id="summary-help-text"><%= t("proposals.form.proposal_summary_note") %></p>

View File

@@ -415,10 +415,8 @@ namespace :proposal_actions do
description = "<p>This is an example of a successful proposal with an ideal progress.</p>"
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",

View File

@@ -22,7 +22,6 @@ feature "Proposals" do
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_video_url", with: "https://www.youtube.com/watch?v=yRYFKcMa_Ek"
@@ -33,7 +32,6 @@ feature "Proposals" do
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 "https://www.youtube.com/watch?v=yRYFKcMa_Ek"

View File

@@ -125,7 +125,6 @@ feature "Proposals" do
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 proposal.author.name
expect(page).to have_content I18n.l(proposal.created_at.to_date)
@@ -218,7 +217,6 @@ feature "Proposals" do
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_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
@@ -238,7 +236,6 @@ feature "Proposals" do
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 "https://www.youtube.com/watch?v=yPQfcG-eimk"
@@ -255,7 +252,6 @@ feature "Proposals" do
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_responsible_name", with: "Some other robot"
@@ -276,10 +272,8 @@ feature "Proposals" do
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"
@@ -296,10 +290,8 @@ feature "Proposals" do
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"
@@ -321,7 +313,6 @@ feature "Proposals" do
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..."
check "proposal_terms_of_service"
@@ -350,10 +341,8 @@ feature "Proposals" do
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: "<p>This is <script>alert('an attack');</script></p>"
fill_in "proposal_external_url", with: "http://rescue.org/refugees"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
@@ -375,7 +364,6 @@ feature "Proposals" do
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: "<p>This is a link www.example.org</p>"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
@@ -398,7 +386,6 @@ feature "Proposals" do
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"
@@ -435,13 +422,7 @@ feature "Proposals" do
login_as(author)
visit new_proposal_path
fill_in "proposal_title", with: "Help 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_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"
@@ -463,10 +444,8 @@ feature "Proposals" do
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"
@@ -622,7 +601,6 @@ feature "Proposals" do
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_responsible_name", with: "Isabel Garcia"
@@ -1825,7 +1803,6 @@ feature "Successful proposals" do
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_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_tag_list", with: "Refugees, Solidarity"

View File

@@ -70,7 +70,6 @@ feature "Tags" do
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,7 +96,6 @@ feature "Tags" do
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_video_url", with: "https://www.youtube.com/watch?v=Ae6gQmhaMn4"
@@ -141,7 +139,6 @@ feature "Tags" do
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_responsible_name", with: "Isabel Garcia"

View File

@@ -54,23 +54,6 @@ describe Proposal do
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"

View File

@@ -250,7 +250,6 @@ end
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

View File

@@ -365,7 +365,6 @@ end
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

View File

@@ -291,7 +291,6 @@ end
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

View File

@@ -26,6 +26,15 @@ module CommonActions
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?