Skip to content

Instantly share code, notes, and snippets.

@frnz
Created June 8, 2012 17:08
Show Gist options
  • Save frnz/2896921 to your computer and use it in GitHub Desktop.
Save frnz/2896921 to your computer and use it in GitHub Desktop.
Photo upload
def third_step
ptypes = params[:user][:profile_attributes][:ptypes]
params[:user][:profile_attributes].delete_if {|key, value|
!ptypes.include?((key.split('_')).first) && key.include?("profile_attributes")
}
set_locale(current_user.profile.preferred_language)
session[:second_step_params] = params[:user]
if exposed_user.profile.facebook_profile?
finalize_sign_up
else
render :add_photo, layout: "simple_header"
end
end
it "should show the upload photo page after second step" do
lambda {
post :third_step, :user_id => u.id, :locale=>"en", :user => {
:profile_attributes => {
"ptypes"=>["", "student", "contributor"],
"student_profile_attributes"=>{"school_name"=>"df"},
"contributor_profile_attributes"=>{"company"=>"df"},
"other_profile_attributes"=>{"description"=>""},
"id" => u.profile.id},
:partner_id =>"10"
}
}
response.should render_template("add_photo")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment