wip, profiles controller and specs, with cucumber failures
This commit is contained in:
parent
f7de3a216a
commit
d1b91e1eac
17 changed files with 204 additions and 150 deletions
|
|
@ -81,32 +81,6 @@ class PeopleController < ApplicationController
|
||||||
redirect_to root_url
|
redirect_to root_url
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
|
||||||
@aspect = :person_edit
|
|
||||||
@person = current_user.person
|
|
||||||
@profile = @person.profile
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
# upload and set new profile photo
|
|
||||||
params[:profile] ||= {}
|
|
||||||
params[:profile][:searchable] ||= false
|
|
||||||
params[:profile][:photo] = Photo.where(:person_id => current_user.person.id,
|
|
||||||
:id => params[:photo_id]).first if params[:photo_id]
|
|
||||||
|
|
||||||
if current_user.update_profile params[:profile]
|
|
||||||
flash[:notice] = I18n.t 'people.update.updated'
|
|
||||||
else
|
|
||||||
flash[:error] = I18n.t 'people.update.failed'
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:getting_started]
|
|
||||||
redirect_to getting_started_path(:step => params[:getting_started].to_i+1)
|
|
||||||
else
|
|
||||||
redirect_to edit_person_path
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def retrieve_remote
|
def retrieve_remote
|
||||||
if params[:diaspora_handle]
|
if params[:diaspora_handle]
|
||||||
webfinger(params[:diaspora_handle], :single_aspect_form => true)
|
webfinger(params[:diaspora_handle], :single_aspect_form => true)
|
||||||
|
|
|
||||||
33
app/controllers/profiles_controller.rb
Normal file
33
app/controllers/profiles_controller.rb
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
class ProfilesController < ApplicationController
|
||||||
|
before_filter :authenticate_user!
|
||||||
|
def edit
|
||||||
|
@person = current_user.person
|
||||||
|
@aspect = :person_edit
|
||||||
|
@profile = @person.profile
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
# upload and set new profile photo
|
||||||
|
params[:profile] ||= {}
|
||||||
|
params[:profile][:searchable] ||= false
|
||||||
|
params[:profile][:photo] = Photo.where(:person_id => current_user.person.id,
|
||||||
|
:id => params[:photo_id]).first if params[:photo_id]
|
||||||
|
|
||||||
|
if current_user.update_profile params[:profile]
|
||||||
|
flash[:notice] = I18n.t 'profiles.update.updated'
|
||||||
|
else
|
||||||
|
flash[:error] = I18n.t 'profiles.update.failed'
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:getting_started]
|
||||||
|
redirect_to getting_started_path(:step => params[:getting_started].to_i+1)
|
||||||
|
else
|
||||||
|
redirect_to edit_profile_path
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
= owner_image_tag(:thumb_small)
|
= owner_image_tag(:thumb_small)
|
||||||
= link_to current_user.name, '#'
|
= link_to current_user.name, '#'
|
||||||
%li= link_to t('.view_profile'), current_user.person
|
%li= link_to t('.view_profile'), current_user.person
|
||||||
%li= link_to t('.edit_profile'), edit_person_path(current_user.person)
|
%li= link_to t('.edit_profile'), edit_profile_path
|
||||||
%li= link_to t('.account_settings'), edit_user_path(current_user)
|
%li= link_to t('.account_settings'), edit_user_path(current_user)
|
||||||
%li= link_to t('.logout'), destroy_user_session_path
|
%li= link_to t('.logout'), destroy_user_session_path
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
%ul{:data => {:role => 'listview', :inset => 'true'}}
|
%ul{:data => {:role => 'listview', :inset => 'true'}}
|
||||||
%li
|
%li
|
||||||
= link_to t('people.edit.your_profile'), person_path(current_user.person)
|
= link_to t('profiles.edit.your_profile'), edit_profile_path
|
||||||
%li
|
%li
|
||||||
= link_to t('notifications.index.notifications'), notifications_path
|
= link_to t('notifications.index.notifications'), notifications_path
|
||||||
.ui-li-count
|
.ui-li-count
|
||||||
|
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
|
||||||
-# the COPYRIGHT file.
|
|
||||||
|
|
||||||
- content_for :page_title do
|
|
||||||
= t('.edit_profile')
|
|
||||||
|
|
||||||
= form_tag person_path(@person), :method => :put, :multipart => true, :id => 'update_profile_form' do
|
|
||||||
%h3
|
|
||||||
= t('people.edit.your_profile')
|
|
||||||
.description
|
|
||||||
= t('people.edit.info_available_to')
|
|
||||||
|
|
||||||
= error_messages_for @person
|
|
||||||
|
|
||||||
%h4
|
|
||||||
= t('people.edit.your_name')
|
|
||||||
= text_field_tag 'profile[first_name]', @profile.first_name, :placeholder => t('people.edit.first_name')
|
|
||||||
= text_field_tag 'profile[last_name]', @profile.last_name, :placeholder => t('people.edit.last_name')
|
|
||||||
|
|
||||||
%h4
|
|
||||||
= t('people.edit.your_gender')
|
|
||||||
%br
|
|
||||||
= text_field_tag 'profile[gender]', @profile.gender, :placeholder => t("fill_me_out")
|
|
||||||
|
|
||||||
%h4
|
|
||||||
= t('people.edit.your_birthday')
|
|
||||||
%br
|
|
||||||
= select_date @person.profile.birthday, :prompt => true,
|
|
||||||
:default => true, :order => t('date.order'), :start_year => 2000, :end_year => 1930, :prefix => 'profile[date]'
|
|
||||||
|
|
||||||
%h4
|
|
||||||
= t('people.edit.your_bio')
|
|
||||||
= text_area_tag 'profile[bio]', @profile.bio, :rows => 5, :placeholder => t('fill_me_out')
|
|
||||||
|
|
||||||
%h4
|
|
||||||
= t('people.edit.your_photo')
|
|
||||||
= render 'photos/new_profile_photo'
|
|
||||||
%br
|
|
||||||
|
|
||||||
%h4
|
|
||||||
= t('search')
|
|
||||||
%p{:class=>"checkbox_select"}
|
|
||||||
= label_tag 'profile[searchable]', t('people.edit.allow_search')
|
|
||||||
= check_box_tag 'profile[searchable]', true, @person.profile.searchable
|
|
||||||
|
|
||||||
= hidden_field_tag :getting_started, @step if @step
|
|
||||||
|
|
||||||
.submit_block
|
|
||||||
=yield(:submit_block)
|
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
- if person == current_user.person
|
- if person == current_user.person
|
||||||
%p
|
%p
|
||||||
= link_to t('people.profile_sidebar.edit_my_profile'), edit_person_path(person)
|
= link_to t('people.profile_sidebar.edit_my_profile'), edit_profile_path
|
||||||
|
|
||||||
%hr{:style=>"width:300px;"}
|
%hr{:style=>"width:300px;"}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@
|
||||||
#file-upload.button
|
#file-upload.button
|
||||||
=t('.upload')
|
=t('.upload')
|
||||||
|
|
||||||
-if !@aspect.nil? && @aspect != :getting_started
|
-if !aspect.nil? && aspect != :getting_started
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
%p
|
%p
|
||||||
\...#{t('.or_select_one')}
|
\...#{t('.or_select_one')}
|
||||||
= link_to t('_photos'), person_photos_path(@person)
|
= link_to t('_photos'), person_photos_path(person)
|
||||||
|
|
||||||
#publisher_photo_upload
|
#publisher_photo_upload
|
||||||
:javascript
|
:javascript
|
||||||
|
|
|
||||||
52
app/views/profiles/_edit.html.haml
Normal file
52
app/views/profiles/_edit.html.haml
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
|
- content_for :page_title do
|
||||||
|
= t('.edit_profile')
|
||||||
|
|
||||||
|
= form_tag profile_path(profile), :method => :put, :multipart => true, :id => 'update_profile_form' do
|
||||||
|
%h3
|
||||||
|
= t('profiles.edit.your_profile')
|
||||||
|
.description
|
||||||
|
= t('profiles.edit.info_available_to')
|
||||||
|
|
||||||
|
= error_messages_for profile
|
||||||
|
|
||||||
|
%h4
|
||||||
|
= t('profiles.edit.your_name')
|
||||||
|
= text_field_tag 'profile[first_name]', profile.first_name, :placeholder => t('profiles.edit.first_name')
|
||||||
|
= text_field_tag 'profile[last_name]', profile.last_name, :placeholder => t('profiles.edit.last_name')
|
||||||
|
|
||||||
|
%h4
|
||||||
|
= t('profiles.edit.your_gender')
|
||||||
|
%br
|
||||||
|
= text_field_tag 'profile[gender]', profile.gender, :placeholder => t("fill_me_out")
|
||||||
|
|
||||||
|
%h4
|
||||||
|
= t('profiles.edit.your_birthday')
|
||||||
|
%br
|
||||||
|
= select_date profile.birthday, :prompt => true,
|
||||||
|
:default => true, :order => t('date.order'), :start_year => 2000, :end_year => 1930, :prefix => 'profile[date]'
|
||||||
|
|
||||||
|
%h4
|
||||||
|
= t('profiles.edit.your_bio')
|
||||||
|
= text_area_tag 'profile[bio]', profile.bio, :rows => 5, :placeholder => t('fill_me_out')
|
||||||
|
|
||||||
|
%h4
|
||||||
|
= t('profiles.edit.your_photo')
|
||||||
|
= render 'photos/new_profile_photo', :aspect => aspect, :person => person
|
||||||
|
%b
|
||||||
|
|
||||||
|
%h4
|
||||||
|
= t('search')
|
||||||
|
%p{:class=>"checkbox_select"}
|
||||||
|
= label_tag 'profile[searchable]', t('profiles.edit.allow_search')
|
||||||
|
= check_box_tag 'profile[searchable]', true, profile.searchable
|
||||||
|
|
||||||
|
= hidden_field_tag :getting_started, step if step
|
||||||
|
|
||||||
|
.submit_block
|
||||||
|
=yield(:submit_block)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
%h2
|
%h2
|
||||||
= t('settings')
|
= t('settings')
|
||||||
%ul#settings_nav
|
%ul#settings_nav
|
||||||
%li=link_to t('profile'), edit_person_path(current_user.person)
|
%li=link_to t('profile'), edit_profile_path
|
||||||
%li=link_to t('account'), edit_user_path(current_user)
|
%li=link_to t('account'), edit_user_path(current_user)
|
||||||
%li=link_to t('_services'), services_path
|
%li=link_to t('_services'), services_path
|
||||||
|
|
||||||
|
|
@ -16,5 +16,6 @@
|
||||||
= link_to t('cancel'), edit_user_path(current_user)
|
= link_to t('cancel'), edit_user_path(current_user)
|
||||||
= t('or')
|
= t('or')
|
||||||
= submit_tag t('.update_profile')
|
= submit_tag t('.update_profile')
|
||||||
= render :partial => 'people/edit'
|
= render :partial => 'edit', :locals => {:person => @person,
|
||||||
|
:profile => @profile, :aspect => @aspect, :step => @step}
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
%h2
|
%h2
|
||||||
= t('settings')
|
= t('settings')
|
||||||
%ul#settings_nav
|
%ul#settings_nav
|
||||||
%li=link_to t('profile'), edit_person_path(current_user.person)
|
%li=link_to t('profile'), edit_profile_path
|
||||||
%li=link_to t('account'), edit_user_path(current_user)
|
%li=link_to t('account'), edit_user_path(current_user)
|
||||||
%li=link_to t('_services'), services_path
|
%li=link_to t('_services'), services_path
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
%h2
|
%h2
|
||||||
= t('settings')
|
= t('settings')
|
||||||
%ul#settings_nav
|
%ul#settings_nav
|
||||||
%li=link_to t('profile'), edit_person_path(current_user.person)
|
%li=link_to t('profile'), edit_profile_path
|
||||||
%li=link_to t('account'), edit_user_path(current_user)
|
%li=link_to t('account'), edit_user_path(current_user)
|
||||||
%li=link_to t('_services'), services_path
|
%li=link_to t('_services'), services_path
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@
|
||||||
|
|
||||||
- content_for :submit_block do
|
- content_for :submit_block do
|
||||||
= submit_tag "#{t('users.getting_started.save_and_continue')} →"
|
= submit_tag "#{t('users.getting_started.save_and_continue')} →"
|
||||||
= render :partial => 'people/edit'
|
= render :partial => 'profiles/edit', :locals => {:person => @person,
|
||||||
|
:profile => @profile, :aspect => @aspect, :step => @step}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,23 @@ en:
|
||||||
no_message_to_display: "No message to display."
|
no_message_to_display: "No message to display."
|
||||||
destroy:
|
destroy:
|
||||||
failure: "Failed to delete post"
|
failure: "Failed to delete post"
|
||||||
|
profiles:
|
||||||
|
edit:
|
||||||
|
info_available_to: "This info will be available to whomever you connect with on Diaspora."
|
||||||
|
your_profile: "Your profile"
|
||||||
|
your_name: "Your name"
|
||||||
|
first_name: "First name"
|
||||||
|
last_name: "Last name"
|
||||||
|
your_gender: "Your gender"
|
||||||
|
your_birthday: "Your birthday"
|
||||||
|
your_bio: "Your bio"
|
||||||
|
your_photo: "Your photo"
|
||||||
|
update_profile: "Update Profile"
|
||||||
|
allow_search: "Allow for people to search for you within Diaspora"
|
||||||
|
edit_profile: "Edit profile"
|
||||||
|
update:
|
||||||
|
updated: "Profile updated"
|
||||||
|
failed: "Failed to update profile"
|
||||||
people:
|
people:
|
||||||
person:
|
person:
|
||||||
pending_request: "pending request"
|
pending_request: "pending request"
|
||||||
|
|
@ -368,22 +385,7 @@ en:
|
||||||
recent_public_posts: "Recent Public Posts"
|
recent_public_posts: "Recent Public Posts"
|
||||||
similar_contacts: "similar contacts"
|
similar_contacts: "similar contacts"
|
||||||
start_sharing: "start sharing"
|
start_sharing: "start sharing"
|
||||||
edit:
|
|
||||||
info_available_to: "This info will be available to whomever you connect with on Diaspora."
|
|
||||||
your_profile: "Your profile"
|
|
||||||
your_name: "Your name"
|
|
||||||
first_name: "First name"
|
|
||||||
last_name: "Last name"
|
|
||||||
your_gender: "Your gender"
|
|
||||||
your_birthday: "Your birthday"
|
|
||||||
your_bio: "Your bio"
|
|
||||||
your_photo: "Your photo"
|
|
||||||
update_profile: "Update Profile"
|
|
||||||
allow_search: "Allow for people to search for you within Diaspora"
|
|
||||||
edit_profile: "Edit profile"
|
|
||||||
update:
|
|
||||||
updated: "Profile updated"
|
|
||||||
failed: "Failed to update profile"
|
|
||||||
profile_sidebar:
|
profile_sidebar:
|
||||||
remove_contact: "remove contact"
|
remove_contact: "remove contact"
|
||||||
edit_my_profile: "Edit my profile"
|
edit_my_profile: "Edit my profile"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ Diaspora::Application.routes.draw do
|
||||||
resources :comments, :only => [:create]
|
resources :comments, :only => [:create]
|
||||||
resources :requests, :only => [:destroy, :create]
|
resources :requests, :only => [:destroy, :create]
|
||||||
|
|
||||||
|
resource :profile
|
||||||
match 'services/inviter/:provider' => 'services#inviter', :as => 'service_inviter'
|
match 'services/inviter/:provider' => 'services#inviter', :as => 'service_inviter'
|
||||||
match 'services/finder/:provider' => 'services#finder', :as => 'friend_finder'
|
match 'services/finder/:provider' => 'services#finder', :as => 'friend_finder'
|
||||||
resources :services
|
resources :services
|
||||||
|
|
@ -19,7 +20,7 @@ Diaspora::Application.routes.draw do
|
||||||
resources :posts, :only => [:show], :path => '/p/'
|
resources :posts, :only => [:show], :path => '/p/'
|
||||||
|
|
||||||
match '/people/share_with' => 'people#share_with', :as => 'share_with'
|
match '/people/share_with' => 'people#share_with', :as => 'share_with'
|
||||||
resources :people do
|
resources :people, :except => [:edit, :update] do
|
||||||
resources :status_messages
|
resources :status_messages
|
||||||
resources :photos
|
resources :photos
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ module NavigationHelpers
|
||||||
when /^the ([\w ]+) page$/
|
when /^the ([\w ]+) page$/
|
||||||
send("#{$1.gsub(/\W+/, '_')}_path")
|
send("#{$1.gsub(/\W+/, '_')}_path")
|
||||||
when /^my edit profile page$/
|
when /^my edit profile page$/
|
||||||
edit_person_path(@me.person)
|
edit_profile_path
|
||||||
when /^my acceptance form page$/
|
when /^my acceptance form page$/
|
||||||
accept_user_invitation_path(:invitation_token => @me.invitation_token)
|
accept_user_invitation_path(:invitation_token => @me.invitation_token)
|
||||||
when /^the requestors profile$/
|
when /^the requestors profile$/
|
||||||
|
|
|
||||||
|
|
@ -155,49 +155,4 @@ describe PeopleController do
|
||||||
get :retrieve_remote, :diaspora_handle => @user.diaspora_handle
|
get :retrieve_remote, :diaspora_handle => @user.diaspora_handle
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#update' do
|
|
||||||
it "sets the flash" do
|
|
||||||
put :update, :id => @user.person.id,
|
|
||||||
:profile => {
|
|
||||||
:image_url => "",
|
|
||||||
:first_name => "Will",
|
|
||||||
:last_name => "Smith"
|
|
||||||
}
|
|
||||||
flash[:notice].should_not be_empty
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'with a profile photo set' do
|
|
||||||
before do
|
|
||||||
@params = { :id => @user.person.id,
|
|
||||||
:profile =>
|
|
||||||
{:image_url => "",
|
|
||||||
:last_name => @user.person.profile.last_name,
|
|
||||||
:first_name => @user.person.profile.first_name }}
|
|
||||||
|
|
||||||
@user.person.profile.image_url = "http://tom.joindiaspora.com/images/user/tom.jpg"
|
|
||||||
@user.person.profile.save
|
|
||||||
end
|
|
||||||
it "doesn't overwrite the profile photo when an empty string is passed in" do
|
|
||||||
image_url = @user.person.profile.image_url
|
|
||||||
put :update, @params
|
|
||||||
|
|
||||||
Person.find(@user.person.id).profile.image_url.should == image_url
|
|
||||||
end
|
|
||||||
end
|
|
||||||
it 'does not allow mass assignment' do
|
|
||||||
person = @user.person
|
|
||||||
new_user = Factory.create(:user)
|
|
||||||
person.owner_id.should == @user.id
|
|
||||||
put :update, :id => @user.person.id, :owner_id => new_user.id
|
|
||||||
Person.find(person.id).owner_id.should == @user.id
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'does not overwrite the profile diaspora handle' do
|
|
||||||
handle_params = {:id => @user.person.id,
|
|
||||||
:profile => {:diaspora_handle => 'abc@a.com'} }
|
|
||||||
put :update, handle_params
|
|
||||||
Person.find(@user.person.id).profile[:diaspora_handle].should_not == 'abc@a.com'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
86
spec/controllers/profiles_controller_spec.rb
Normal file
86
spec/controllers/profiles_controller_spec.rb
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||||
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe ProfilesController do
|
||||||
|
render_views
|
||||||
|
before do
|
||||||
|
@user = eve
|
||||||
|
sign_in :user, @user
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#edit' do
|
||||||
|
it 'succeeds' do
|
||||||
|
get :edit
|
||||||
|
response.should be_success
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets the profile to the current users profile' do
|
||||||
|
get :edit
|
||||||
|
assigns[:profile].should == @user.person.profile
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets the aspect to "person_edit" ' do
|
||||||
|
get :edit
|
||||||
|
assigns[:aspect].should == :person_edit
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'sets the person to the current users person' do
|
||||||
|
get :edit
|
||||||
|
assigns[:person].should == @user.person
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
describe '#update' do
|
||||||
|
it "sets the flash" do
|
||||||
|
put :update, :profile => {
|
||||||
|
:image_url => "",
|
||||||
|
:first_name => "Will",
|
||||||
|
:last_name => "Smith"
|
||||||
|
}
|
||||||
|
flash[:notice].should_not be_empty
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with a profile photo set' do
|
||||||
|
before do
|
||||||
|
@params = { :id => @user.person.id,
|
||||||
|
:profile =>
|
||||||
|
{:image_url => "",
|
||||||
|
:last_name => @user.person.profile.last_name,
|
||||||
|
:first_name => @user.person.profile.first_name }}
|
||||||
|
|
||||||
|
@user.person.profile.image_url = "http://tom.joindiaspora.com/images/user/tom.jpg"
|
||||||
|
@user.person.profile.save
|
||||||
|
end
|
||||||
|
it "doesn't overwrite the profile photo when an empty string is passed in" do
|
||||||
|
image_url = @user.person.profile.image_url
|
||||||
|
put :update, @params
|
||||||
|
|
||||||
|
Person.find(@user.person.id).profile.image_url.should == image_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'mass assignment' do
|
||||||
|
before do
|
||||||
|
new_person = Factory(:person)
|
||||||
|
@profile_params = {:profile =>{ :person_id => new_person.id,
|
||||||
|
:diaspora_handle => 'abc@a.com'}}
|
||||||
|
end
|
||||||
|
it 'person_id' do
|
||||||
|
person = @user.person
|
||||||
|
profile = person.profile
|
||||||
|
put :update, @profile_params
|
||||||
|
profile.reload.person_id.should == person.id
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'diaspora handle' do
|
||||||
|
put :update, @profile_params
|
||||||
|
Person.find(@user.person.id).profile[:diaspora_handle].should_not == 'abc@a.com'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue