Created
June 8, 2012 17:08
-
-
Save frnz/2896921 to your computer and use it in GitHub Desktop.
Photo upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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