Commit e7445aa366e11b9f4559a764147ba26c7f2ac3d0
1 parent
2323e522
Exists in
master
and in
28 other branches
[macro-support-review] Removing unnecessary tests
Showing
4 changed files
with
23 additions
and
55 deletions
Show diff stats
lib/noosfero/plugin/macro.rb
plugins/comment_group/lib/comment_group_plugin.rb
1 | 1 | require_dependency 'comment_group_plugin/ext/article' |
2 | 2 | require_dependency 'comment_group_plugin/ext/comment' |
3 | 3 | |
4 | -#FIXME See a better way to generalize this parameter. | |
5 | -ActionView::Base.sanitized_allowed_attributes += ['data-macro', 'data-macro-group_id'] | |
6 | - | |
7 | 4 | class CommentGroupPlugin < Noosfero::Plugin |
8 | 5 | |
9 | 6 | def self.plugin_name |
... | ... | @@ -18,23 +15,6 @@ class CommentGroupPlugin < Noosfero::Plugin |
18 | 15 | article.comments.without_spam.without_group.as_thread |
19 | 16 | end |
20 | 17 | |
21 | - #FIXME make this test | |
22 | - def macro_display_comments(params, inner_html, source) | |
23 | - group_id = params[:group_id].to_i | |
24 | - article = source | |
25 | - count = article.group_comments.without_spam.in_group(group_id).count | |
26 | - | |
27 | - lambda {render :partial => 'plugins/comment_group_macro/views/comment_group.rhtml', :locals => {:group_id => group_id, :article_id => article.id, :inner_html => inner_html, :count => count, :profile_identifier => article.profile.identifier }} | |
28 | - end | |
29 | - | |
30 | - def macro_methods | |
31 | - 'macro_display_comments' | |
32 | - end | |
33 | - | |
34 | - def config_macro_display_comments | |
35 | - { :params => [], :skip_dialog => true, :generator => 'makeCommentable();', :js_files => 'comment_group.js', :icon_path => '/designs/icons/tango/Tango/16x16/emblems/emblem-system.png', :css_files => 'comment_group.css' } | |
36 | - end | |
37 | - | |
38 | 18 | def comment_form_extra_contents(args) |
39 | 19 | comment = args[:comment] |
40 | 20 | group_id = comment.group_id || args[:group_id] | ... | ... |
plugins/comment_group/lib/comment_group_plugin/macros/allow_comment.rb
0 → 100644
... | ... | @@ -0,0 +1,22 @@ |
1 | +#FIXME See a better way to generalize this parameter. | |
2 | +ActionView::Base.sanitized_allowed_attributes += ['data-macro', 'data-macro-group_id'] | |
3 | + | |
4 | +class CommentGroupPlugin::AllowComment < Noosfero::Plugin::Macro | |
5 | + def self.configuration | |
6 | + { :params => [], | |
7 | + :skip_dialog => true, | |
8 | + :generator => 'makeCommentable();', | |
9 | + :js_files => 'comment_group.js', | |
10 | + :icon_path => '/designs/icons/tango/Tango/16x16/emblems/emblem-system.png', | |
11 | + :css_files => 'comment_group.css' } | |
12 | + end | |
13 | + | |
14 | + #FIXME Make this test | |
15 | + def parse(params, inner_html, source) | |
16 | + group_id = params[:group_id].to_i | |
17 | + article = source | |
18 | + count = article.group_comments.without_spam.in_group(group_id).count | |
19 | + | |
20 | + lambda {render :partial => 'plugins/comment_group_macro/views/comment_group.rhtml', :locals => {:group_id => group_id, :article_id => article.id, :inner_html => inner_html, :count => count, :profile_identifier => article.profile.identifier }} | |
21 | + end | |
22 | +end | ... | ... |
plugins/comment_group/test/unit/comment_group_plugin_test.rb
... | ... | @@ -10,16 +10,6 @@ class CommentGroupPluginTest < ActiveSupport::TestCase |
10 | 10 | |
11 | 11 | attr_reader :environment |
12 | 12 | |
13 | - should 'register comment_group_macro in environment' do | |
14 | - Environment.macros = {} | |
15 | - Environment.macros[environment.id] = {} | |
16 | - macros = Environment.macros[environment.id] | |
17 | - context = mock() | |
18 | - context.stubs(:environment).returns(environment) | |
19 | - plugin = CommentGroupPlugin.new(context) | |
20 | - assert_equal ['macro_display_comments'], macros.keys | |
21 | - end | |
22 | - | |
23 | 13 | should 'load_comments returns all the comments wihout group of an article passed as parameter' do |
24 | 14 | article = fast_create(Article) |
25 | 15 | c1 = fast_create(Comment, :source_id => article.id, :group_id => 1) |
... | ... | @@ -52,30 +42,5 @@ class CommentGroupPluginTest < ActiveSupport::TestCase |
52 | 42 | assert_equal [], [c2] - plugin.load_comments(article) |
53 | 43 | assert_equal [], plugin.load_comments(article) - [c2] |
54 | 44 | end |
55 | - | |
56 | - should 'params of macro display comments configuration be an empty array' do | |
57 | - plugin = CommentGroupPlugin.new | |
58 | - assert_equal [], plugin.config_macro_display_comments[:params] | |
59 | - end | |
60 | - | |
61 | - should 'skip_dialog of macro display comments configuration be true' do | |
62 | - plugin = CommentGroupPlugin.new | |
63 | - assert plugin.config_macro_display_comments[:skip_dialog] | |
64 | - end | |
65 | - | |
66 | - should 'generator of macro display comments configuration be the makeCommentable function' do | |
67 | - plugin = CommentGroupPlugin.new | |
68 | - assert_equal 'makeCommentable();', plugin.config_macro_display_comments[:generator] | |
69 | - end | |
70 | - | |
71 | - should 'js_files of macro display comments configuration return comment_group.js' do | |
72 | - plugin = CommentGroupPlugin.new | |
73 | - assert_equal 'comment_group.js', plugin.config_macro_display_comments[:js_files] | |
74 | - end | |
75 | - | |
76 | - should 'css_files of macro display comments configuration return comment_group.css' do | |
77 | - plugin = CommentGroupPlugin.new | |
78 | - assert_equal 'comment_group.css', plugin.config_macro_display_comments[:css_files] | |
79 | - end | |
80 | 45 | |
81 | 46 | end | ... | ... |