Permalink
Browse files

the registration#edit respond to xml with the user info

  • Loading branch information...
1 parent a2cbfa4 commit 6f005a578aa46d15c4a363bac90306c75547396c @flype flype committed Mar 18, 2011
Showing with 11 additions and 2 deletions.
  1. +4 −1 app/controllers/devise/registrations_controller.rb
  2. +7 −1 test/integration/registerable_test.rb
View
5 app/controllers/devise/registrations_controller.rb
@@ -33,7 +33,10 @@ def create
# GET /resource/edit
def edit
- render_with_scope :edit
+ respond_with(resource) do |format|
+ format.any(*navigational_formats) {}
+ format.html { render_with_scope :edit }
+ end
end
# PUT /resource
View
8 test/integration/registerable_test.rb
@@ -205,7 +205,13 @@ class RegistrationTest < ActionController::IntegrationTest
user = sign_in_as_user
put user_registration_path(:format => 'xml'), :user => { :current_password => '123456', :email => 'user.new@test.com' }
assert_response :success
- assert_equal user.reload.email, 'user.new@test.com'
+ end
+
+ test 'a user retriew his information should return the information in XML' do
+ user = sign_in_as_user
+ get edit_user_registration_path(:format => 'xml')
+ assert_response :success
+ assert response.body.include? %(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>)
end
test 'a user update information with invalid data in XML format should return invalid response' do

0 comments on commit 6f005a5

Please sign in to comment.