diff --git a/test/unit/comment_helper_test.rb b/test/unit/comment_helper_test.rb index 479c7f7..545801e 100644 --- a/test/unit/comment_helper_test.rb +++ b/test/unit/comment_helper_test.rb @@ -12,6 +12,7 @@ class CommentHelperTest < ActiveSupport::TestCase self.stubs(:logged_in?).returns(true) self.stubs(:report_abuse).returns('link') self.stubs(:expirable_comment_link).returns('link') + @plugins = [] @plugins.stubs(:dispatch).returns([]) end @@ -19,7 +20,7 @@ class CommentHelperTest < ActiveSupport::TestCase should 'show menu if it has links for actions' do article = Article.new(:profile => profile) - comment = Comment.new(:article => article) + comment = build(Comment, :article => article) menu = comment_actions(comment) assert menu end @@ -43,7 +44,7 @@ class CommentHelperTest < ActiveSupport::TestCase should 'include actions of plugins in menu' do article = Article.new(:profile => profile) - comment = Comment.new(:article => article) + comment = build(Comment, :article => article) plugin_action = {:link => 'plugin_action'} @plugins.stubs(:dispatch).returns([plugin_action]) links = links_for_comment_actions(comment) @@ -52,8 +53,8 @@ class CommentHelperTest < ActiveSupport::TestCase should 'include lambda actions of plugins in menu' do article = Article.new(:profile => profile) - comment = Comment.new(:article => article) - plugin_action = lambda{[{:link => 'plugin_action'}, {:link => 'plugin_action2'}]} + comment = build(Comment, :article => article) + plugin_action = proc{[{:link => 'plugin_action'}, {:link => 'plugin_action2'}]} @plugins.stubs(:dispatch).returns([plugin_action]) links = links_for_comment_actions(comment) assert_includes links, {:link => 'plugin_action'} -- libgit2 0.21.2