Skip to content

Commit

Permalink
Finish #421 (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
northeastprince authored Feb 5, 2024
1 parent 475fbff commit 24bef5a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
13 changes: 1 addition & 12 deletions app/controllers/hackathons/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ def new
end

def create
requested_swag = params[:requested_swag] == "1"
offers_financial_assistance = params[:hackathon][:offers_financial_assistance] == "true"

@hackathon = Hackathon.new(hackathon_params)

@hackathon.swag_mailing_address = nil unless requested_swag
@hackathon.tag_with! "Offers Financial Assistance" if offers_financial_assistance

@hackathon.applicant = User.find_or_initialize_by(email_address: applicant_params[:email_address]) do |user|
Expand Down Expand Up @@ -54,16 +52,7 @@ def hackathon_params
:postal_code,
:country_code,
:expected_attendees,
:high_school_led,
# Swag
swag_mailing_address_attributes: [
:line1,
:line2,
:city,
:province,
:postal_code,
:country_code
]
:high_school_led
)
end

Expand Down
32 changes: 0 additions & 32 deletions test/system/hackathon_submission_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,4 @@ class HackathonSubmissionTest < ApplicationSystemTestCase
assert_equal "Assemble", Hackathon.last.name
assert_not Hackathon.last.requested_swag?
end

test "submitting a hackathon wanting swag" do
visit new_hackathons_submission_path

fill_in "Your name", with: "Gary"
fill_in "Email address", with: "[email protected]"
select "No", from: "Are you a high schooler?"

fill_in "Name of the hackathon", with: "Assemble"
fill_in "Start date", with: 1.month.from_now.beginning_of_minute
fill_in "End date", with: (1.month.from_now + 2.days).beginning_of_minute
fill_in "Website", with: "https://assemble.hackclub.com"

attach_file "Logo", Rails.root.join("test/fixtures/files/assemble_logo.jpg")
attach_file "Banner", Rails.root.join("test/fixtures/files/assemble.jpg")

select "In Person", from: "Where is the hackathon taking place?"
fill_in "Street", with: "760 Market St"
fill_in "City", with: "San Francisco"
fill_in "State/Province", with: "CA"
fill_in "ZIP/Postal Code", with: "94102"
select "United States", from: "Country"

fill_in :hackathon_expected_attendees, with: 100

select "Yes", from: :hackathon_offers_financial_assistance

assert_difference -> { Hackathon.count } do
click_on "Submit for Review"
assert_text(/submitted/i)
end
end
end

0 comments on commit 24bef5a

Please sign in to comment.