Commit 096ea0b20a3d25b8098aca7c398678eb620b32b7

Authored by Carlos Purificação
1 parent f159aad4

Changed method to delete

app/api/v1/articles.rb
@@ -54,7 +54,7 @@ module Api @@ -54,7 +54,7 @@ module Api
54 present_partial article, :with => Entities::Article 54 present_partial article, :with => Entities::Article
55 end 55 end
56 56
57 - post ':id/remove' do 57 + delete ':id' do
58 article = environment.articles.find(params[:id]) 58 article = environment.articles.find(params[:id])
59 return forbidden! unless article.allow_delete?(current_person) 59 return forbidden! unless article.allow_delete?(current_person)
60 begin 60 begin
test/api/articles_test.rb
@@ -11,14 +11,14 @@ class ArticlesTest < ActiveSupport::TestCase @@ -11,14 +11,14 @@ class ArticlesTest < ActiveSupport::TestCase
11 article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") 11 article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing")
12 article = Article.find(article.id) 12 article = Article.find(article.id)
13 assert_not_nil article 13 assert_not_nil article
14 - post "/api/v1/articles/#{article.id}/remove?#{params.to_query}" 14 + delete "/api/v1/articles/#{article.id}?#{params.to_query}"
15 json = JSON.parse(last_response.body) 15 json = JSON.parse(last_response.body)
16 16
17 assert_not_equal 401, last_response.status 17 assert_not_equal 401, last_response.status
18 assert_equal true, json['success'] 18 assert_equal true, json['success']
19 19
20 assert !Article.exists?(article.id) 20 assert !Article.exists?(article.id)
21 - end 21 + end
22 22
23 should 'list articles' do 23 should 'list articles' do
24 article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") 24 article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing")