From 0ebb597b723f6edab3a9b935f07669d3145b8009 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 7 Oct 2010 15:22:03 -0700 Subject: [PATCH] DG MS; test for users#export --- app/controllers/users_controller.rb | 2 +- app/views/users/edit.html.haml | 4 ++++ spec/controllers/users_controller_spec.rb | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0ee354dfb..ac22a32b7 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -59,7 +59,7 @@ class UsersController < ApplicationController def export exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML) - render :xml => exporter.execute(current_user) + send_data exporter.execute(current_user), :filename => "#{current_user.username}_diaspora_data.xml", :type => :xml end private diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml index 81fc639e7..e3fdca4ff 100644 --- a/app/views/users/edit.html.haml +++ b/app/views/users/edit.html.haml @@ -19,11 +19,15 @@ - content_for :left_pane do %ul#settings_nav %li=link_to 'Profile', '#', :class => 'profile' + %li=link_to 'Account', '#', :class => 'account' %li=link_to 'Services', '#', :class => 'services' #profile.settings_pane{:style=>"display:block;"} = render 'users/profile' +#account.settings_pane + = link_to "download my stuff", users_export_path, :class => "button" + #services.settings_pane = render 'users/services' diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 0352d2bf2..69c4b6df3 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -11,6 +11,14 @@ describe UsersController do @user.aspect(:name => "lame-os") end + describe '#export' do + it 'should return an xml file' do + get :export + response.header["Content-Type"].should include "application/xml" + end + end + + describe '#update' do context 'with a profile photo set' do before do