Commit 6afc4db6bed3c32715314f10bc6f95c7e10a8ac4
1 parent
12172bd1
Exists in
master
and in
28 other branches
[comments-refactor-review] Cleaning up the code
Removing obsolete FIXME's, trailing whitespaces and so.
Showing
5 changed files
with
17 additions
and
61 deletions
Show diff stats
app/views/tasks/_approve_comment_accept_details.rhtml
config/plugins/comment_actions
test/functional/comment_controller_test.rb
... | ... | @@ -361,7 +361,7 @@ class CommentControllerTest < ActionController::TestCase |
361 | 361 | should "render the root comment when a reply is made" do |
362 | 362 | login_as profile.identifier |
363 | 363 | page = profile.articles.create!(:name => 'myarticle') |
364 | - | |
364 | + | |
365 | 365 | comment = fast_create(Comment, :body => 'some content', :source_id => page.id, :source_type => 'Article') |
366 | 366 | |
367 | 367 | xhr :post, :create, :profile => profile.identifier, :id => page.id, :comment => {:body => 'Some comment...', :reply_of_id => comment.id}, :confirm => 'true' | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -83,34 +83,6 @@ class ContentViewerControllerTest < ActionController::TestCase |
83 | 83 | assert_equal feed.data, @response.body |
84 | 84 | end |
85 | 85 | |
86 | -#FIXME Leandro The link to remove comment changes. Fix this test | |
87 | -# should 'display remove comment button' do | |
88 | -# profile = create_user('testuser').person | |
89 | -# article = profile.articles.build(:name => 'test') | |
90 | -# article.save! | |
91 | -# comment = article.comments.build(:author => profile, :title => 'a comment', :body => 'lalala') | |
92 | -# comment.save! | |
93 | -# | |
94 | -# login_as 'testuser' | |
95 | -# get :view_page, :profile => 'testuser', :page => [ 'test' ] | |
96 | -# assert_tag :tag => 'a', :attributes => { :onclick => %r(/testuser/test\?remove_comment=#{comment.id}.quot) } | |
97 | -# end | |
98 | - | |
99 | -#FIXME Leandro The link to remove comment changes. Fix this test | |
100 | -# should 'display remove comment button with param view when image' do | |
101 | -# profile = create_user('testuser').person | |
102 | -# | |
103 | -# image = UploadedFile.create!(:profile => profile, :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
104 | -# image.save! | |
105 | -# | |
106 | -# comment = image.comments.build(:author => profile, :title => 'a comment', :body => 'lalala') | |
107 | -# comment.save! | |
108 | -# | |
109 | -# login_as 'testuser' | |
110 | -# get :view_page, :profile => 'testuser', :page => [ image.filename ], :view => true | |
111 | -# assert_tag :tag => 'a', :attributes => { :onclick => %r(/testuser/#{image.filename}\?remove_comment=#{comment.id}.*amp;view=true.quot) } | |
112 | -# end | |
113 | - | |
114 | 86 | should "display current article's tags" do |
115 | 87 | page = profile.articles.create!(:name => 'myarticle', :body => 'test article', :tag_list => 'tag1, tag2') |
116 | 88 | |
... | ... | @@ -209,18 +181,17 @@ class ContentViewerControllerTest < ActionController::TestCase |
209 | 181 | assert_response :success |
210 | 182 | end |
211 | 183 | |
212 | -#FIXME Leandro make this test woks | |
213 | -# should 'load the correct profile when using hosted domain' do | |
214 | -# profile = create_user('mytestuser').person | |
215 | -# profile.domains << Domain.create!(:name => 'micojones.net') | |
216 | -# profile.save! | |
217 | -# | |
218 | -# ActionController::TestRequest.any_instance.expects(:host).returns('www.micojones.net').at_least_once | |
219 | -# | |
220 | -# get :view_page, :page => [] | |
221 | -# | |
222 | -# assert_equal profile, assigns(:profile) | |
223 | -# end | |
184 | + should 'load the correct profile when using hosted domain' do | |
185 | + profile = create_user('mytestuser').person | |
186 | + profile.domains << Domain.create!(:name => 'micojones.net') | |
187 | + profile.save! | |
188 | + | |
189 | + ActionController::TestRequest.any_instance.expects(:host).returns('www.micojones.net').at_least_once | |
190 | + | |
191 | + get :view_page, :page => [] | |
192 | + | |
193 | + assert_equal profile, assigns(:profile) | |
194 | + end | |
224 | 195 | |
225 | 196 | should 'give link to edit the article for owner' do |
226 | 197 | login_as('testinguser') |
... | ... | @@ -1082,20 +1053,6 @@ class ContentViewerControllerTest < ActionController::TestCase |
1082 | 1053 | assert_no_tag :tag => 'ul', :attributes => { :class => 'comment-replies' } |
1083 | 1054 | end |
1084 | 1055 | |
1085 | -#FIXME Leandro make this test woks | |
1086 | -# should 'show reply error' do | |
1087 | -# profile = create_user('testuser').person | |
1088 | -# article = profile.articles.build(:name => 'test') | |
1089 | -# article.save! | |
1090 | -# comment = article.comments.build(:author => profile, :title => 'root', :body => 'root') | |
1091 | -# comment.save! | |
1092 | -# login_as 'testuser' | |
1093 | -# post :view_page, :profile => profile.identifier, :page => ['test'], :comment => { :title => '', :body => '', :reply_of_id => comment.id }, :confirm => 'true' | |
1094 | -# assert_tag :tag => 'div', :attributes => { :class => /comment_reply/ }, :descendant => {:tag => 'div', :attributes => {:class => 'errorExplanation'} } | |
1095 | -# assert_no_tag :tag => 'div', :attributes => { :id => 'page-comment-form' }, :descendant => {:tag => 'div', :attributes => {:class => 'errorExplanation'} } | |
1096 | -# assert_tag :tag => 'div', :attributes => { :id => 'page-comment-form' }, :descendant => { :tag => 'div', :attributes => { :class => /post_comment_box closed/ } } | |
1097 | -# end | |
1098 | - | |
1099 | 1056 | should 'add an zero width space every 4 caracters of comment urls' do |
1100 | 1057 | url = 'www.an.url.to.be.splited.com' |
1101 | 1058 | a = fast_create(TextileArticle, :profile_id => @profile.id, :path => 'textile', :language => 'en') | ... | ... |
test/unit/comment_helper_test.rb
... | ... | @@ -23,14 +23,14 @@ class CommentHelperTest < ActiveSupport::TestCase |
23 | 23 | menu = comment_actions(comment) |
24 | 24 | assert menu |
25 | 25 | end |
26 | - | |
26 | + | |
27 | 27 | should 'do not show menu if it has no actions' do |
28 | 28 | comment = Comment.new |
29 | 29 | self.stubs(:links_for_comment_actions).returns([]) |
30 | 30 | menu = comment_actions(comment) |
31 | 31 | assert !menu |
32 | 32 | end |
33 | - | |
33 | + | |
34 | 34 | should 'do not show menu if it has nil actions only' do |
35 | 35 | comment = Comment.new |
36 | 36 | self.stubs(:link_for_report_abuse).returns(nil) |
... | ... | @@ -59,14 +59,14 @@ class CommentHelperTest < ActiveSupport::TestCase |
59 | 59 | assert_includes links, {:link => 'plugin_action'} |
60 | 60 | assert_includes links, {:link => 'plugin_action2'} |
61 | 61 | end |
62 | - | |
62 | + | |
63 | 63 | should 'return link for report abuse action when comment has a author' do |
64 | 64 | comment = Comment.new |
65 | 65 | comment.author = user |
66 | 66 | link = link_for_report_abuse(comment) |
67 | 67 | assert link |
68 | 68 | end |
69 | - | |
69 | + | |
70 | 70 | should 'do not return link for report abuse action when comment has no author' do |
71 | 71 | comment = Comment.new |
72 | 72 | link = link_for_report_abuse(comment) | ... | ... |