Commit f159aad41a0e3bf40c41932ed5a444016b6d3c40

Authored by Carlos Purificação
1 parent f40b0ca9

Added test assertion on article existence

Showing 1 changed file with 4 additions and 0 deletions   Show diff stats
test/api/articles_test.rb
@@ -9,11 +9,15 @@ class ArticlesTest < ActiveSupport::TestCase @@ -9,11 +9,15 @@ class ArticlesTest < ActiveSupport::TestCase
9 9
10 should 'remove article' do 10 should 'remove article' do
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)
  13 + assert_not_nil article
12 post "/api/v1/articles/#{article.id}/remove?#{params.to_query}" 14 post "/api/v1/articles/#{article.id}/remove?#{params.to_query}"
13 json = JSON.parse(last_response.body) 15 json = JSON.parse(last_response.body)
14 16
15 assert_not_equal 401, last_response.status 17 assert_not_equal 401, last_response.status
16 assert_equal true, json['success'] 18 assert_equal true, json['success']
  19 +
  20 + assert !Article.exists?(article.id)
17 end 21 end
18 22
19 should 'list articles' do 23 should 'list articles' do