From 1c1b12d9f9bf0ea1b0d00d1cf7b4d57d2fbabce8 Mon Sep 17 00:00:00 2001 From: Carlos Purificacao Date: Fri, 20 May 2016 17:18:00 -0300 Subject: [PATCH] Fixed review points --- test/api/articles_test.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/api/articles_test.rb b/test/api/articles_test.rb index 367d0f1..bf378d8 100644 --- a/test/api/articles_test.rb +++ b/test/api/articles_test.rb @@ -9,8 +9,6 @@ class ArticlesTest < ActiveSupport::TestCase should 'remove article' do article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") - article = Article.find(article.id) - assert_not_nil article delete "/api/v1/articles/#{article.id}?#{params.to_query}" json = JSON.parse(last_response.body) @@ -20,6 +18,15 @@ class ArticlesTest < ActiveSupport::TestCase assert !Article.exists?(article.id) end + should 'not remove article without permission' do + otherPerson = fast_create(Person, :name => "Other Person") + article = fast_create(Article, :profile_id => otherPerson.id, :name => "Some thing") + delete "/api/v1/articles/#{article.id}?#{params.to_query}" + json = JSON.parse(last_response.body) + assert_equal 403, last_response.status + assert Article.exists?(article.id) + end + should 'list articles' do article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing") get "/api/v1/articles/?#{params.to_query}" -- libgit2 0.21.2