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