Commit f306fc960754958af153f4d1d0aad9a4c828485f
1 parent
f642d361
Exists in
staging
and in
31 other branches
fix unit test
Showing
1 changed file
with
12 additions
and
11 deletions
Show diff stats
test/api/comments_test.rb
... | ... | @@ -71,7 +71,8 @@ class CommentsTest < ActiveSupport::TestCase |
71 | 71 | assert_equal body, json['comment']['body'] |
72 | 72 | end |
73 | 73 | |
74 | - should 'not comment an archived article' do | |
74 | + should 'logged user not comment an archived article' do | |
75 | + login_api | |
75 | 76 | article = fast_create(Article, :profile_id => user.person.id, :name => "Some thing", :archived => true) |
76 | 77 | body = 'My comment' |
77 | 78 | params.merge!({:body => body}) |
... | ... | @@ -81,16 +82,16 @@ class CommentsTest < ActiveSupport::TestCase |
81 | 82 | end |
82 | 83 | |
83 | 84 | should 'logged user comment creation define the source' do |
84 | - login_api | |
85 | - amount = Comment.count | |
86 | - article = fast_create(Article, :profile_id => local_person.id, :name => "Some thing") | |
87 | - body = 'My comment' | |
88 | - params.merge!({:body => body}) | |
89 | - | |
90 | - post "/api/v1/articles/#{article.id}/comments?#{params.to_query}" | |
91 | - assert_equal amount + 1, Comment.count | |
92 | - comment = Comment.last | |
93 | - assert_not_nil comment.source | |
85 | + login_api | |
86 | + amount = Comment.count | |
87 | + article = fast_create(Article, :profile_id => local_person.id, :name => "Some thing") | |
88 | + body = 'My comment' | |
89 | + params.merge!({:body => body}) | |
90 | + | |
91 | + post "/api/v1/articles/#{article.id}/comments?#{params.to_query}" | |
92 | + assert_equal amount + 1, Comment.count | |
93 | + comment = Comment.last | |
94 | + assert_not_nil comment.source | |
94 | 95 | end |
95 | 96 | |
96 | 97 | should 'call plugin hotspot to filter unavailable comments' do | ... | ... |