[Git][noosfero/noosfero][master] api: travis: fix api tests on newer rails
Bráulio Bhavamitra
gitlab at mg.gitlab.com
Sun Mar 5 20:10:06 BRT 2017
Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero
Commits:
b00d8d22 by Braulio Bhavamitra at 2017-03-05T20:09:20-03:00
api: travis: fix api tests on newer rails
- - - - -
2 changed files:
- app/api/v1/articles.rb
- test/api/profiles_test.rb
Changes:
=====================================
app/api/v1/articles.rb
=====================================
--- a/app/api/v1/articles.rb
+++ b/app/api/v1/articles.rb
@@ -59,10 +59,10 @@ module Api
return forbidden! unless article.allow_delete?(current_person)
begin
article.destroy
- { :success => true }
+ { success: true }.to_json
rescue Exception => exception
render_api_error!(_('The article couldn\'t be removed due to some problem. Please contact the administrator.'), Api::Status::BAD_REQUEST)
- end
+ end
end
desc 'Report a abuse and/or violent content in a article by id' do
=====================================
test/api/profiles_test.rb
=====================================
--- a/test/api/profiles_test.rb
+++ b/test/api/profiles_test.rb
@@ -50,7 +50,7 @@ class ProfilesTest < ActiveSupport::TestCase
delete "/api/v1/profiles/#{profile.id}?#{params.to_query}"
- assert_equal 200, last_response.status
+ assert_includes [200, 204], last_response.status
assert_nil Profile.find_by_id profile.id
end
@@ -69,7 +69,7 @@ class ProfilesTest < ActiveSupport::TestCase
should 'person delete itself' do
login_api
delete "/api/v1/profiles/#{@person.id}?#{params.to_query}"
- assert_equal 200, last_response.status
+ assert_includes [200, 204], last_response.status
assert_nil Profile.find_by_id @person.id
end
@@ -87,7 +87,7 @@ class ProfilesTest < ActiveSupport::TestCase
delete "/api/v1/profiles/#{profile.id}?#{params.to_query}"
- assert_equal 200, last_response.status
+ assert_includes [200, 204], last_response.status
assert_nil Profile.find_by_id profile.id
end
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/b00d8d22c2d44500c5b071c6b8f3407312b0fe98
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170305/703fe95b/attachment-0001.html>
More information about the Noosfero-dev
mailing list