Commit f4c57c01b3d6452f061b597005c6a28299317ce7
1 parent
2f3ace84
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Fix user messages
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
lib/noosfero/api/helpers.rb
@@ -254,7 +254,7 @@ require 'grape' | @@ -254,7 +254,7 @@ require 'grape' | ||
254 | if javascript_console_message.present? | 254 | if javascript_console_message.present? |
255 | error!(message_hash, status) | 255 | error!(message_hash, status) |
256 | else | 256 | else |
257 | - error!(user_message, status) | 257 | + error!({'message' => user_message, :code => status}, status) |
258 | end | 258 | end |
259 | end | 259 | end |
260 | 260 |
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 |