ref: master
plugins/comment_group/test/functional/comment_group_plugin_public_controller_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
require_relative '../test_helper' require_relative '../../controllers/public/comment_group_plugin_public_controller' class CommentGroupPluginPublicControllerTest < ActionController::TestCase def setup @controller = CommentGroupPluginPublicController.new @profile = create_user('testuser').person @article = profile.articles.build(:name => 'test') @article.save! end attr_reader :article attr_reader :profile should 'be able to return group_id for a comment' do comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0) xhr :get, :comment_group, :id => comment.id assert_match /\{\"group_id\":0\}/, @response.body end should 'return group_id=null for a global comment' do comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala' ) xhr :get, :comment_group, :id => comment.id assert_match /\{\"group_id\":null\}/, @response.body end end |