Commit 8f333bbc049662d8e9344ec5b3964e53c6828915
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'api_captcha_with_frontend_console_feedback' into api
* api_captcha_with_frontend_console_feedback: Fix user messages
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
lib/noosfero/api/helpers.rb
@@ -273,7 +273,7 @@ require 'grape' | @@ -273,7 +273,7 @@ require 'grape' | ||
273 | if javascript_console_message.present? | 273 | if javascript_console_message.present? |
274 | error!(message_hash, status) | 274 | error!(message_hash, status) |
275 | else | 275 | else |
276 | - error!(user_message, status) | 276 | + error!({'message' => user_message, :code => status}, status) |
277 | end | 277 | end |
278 | end | 278 | end |
279 | 279 |
test/unit/api/users_test.rb
@@ -29,7 +29,7 @@ class UsersTest < ActiveSupport::TestCase | @@ -29,7 +29,7 @@ class UsersTest < ActiveSupport::TestCase | ||
29 | params[:user] = {:login => 'some', :password => '123456', :password_confirmation => '123456', :email => 'some@some.com'} | 29 | params[:user] = {:login => 'some', :password => '123456', :password_confirmation => '123456', :email => 'some@some.com'} |
30 | post "/api/v1/users?#{params.to_query}" | 30 | post "/api/v1/users?#{params.to_query}" |
31 | json = JSON.parse(last_response.body) | 31 | json = JSON.parse(last_response.body) |
32 | - assert_equal 'Username / Email já está em uso,e-Mail já está em uso', json['error'] | 32 | + assert_equal 'Username / Email já está em uso,e-Mail já está em uso', json['message'] |
33 | end | 33 | end |
34 | 34 | ||
35 | should 'return 400 status for invalid user creation' do | 35 | should 'return 400 status for invalid user creation' do |