Sha256: fd32aec4b253302b1c62eb5dc33a3539f64d01b8b237e1fd7b3686f734341ae7

Contents?: true

Size: 1.56 KB

Versions: 7

Compression:

Stored size: 1.56 KB

Contents

require 'test_helper'

module Workarea
  module Admin
    class CommentsSystemTest < SystemTest
      include Admin::IntegrationTest

      def test_allows_commenting
        user = create_user(email: 'bcrouse-test@workarea.com')
        visit admin.user_path(user)

        click_link 'Comments'

        fill_in 'comment[body]', with: 'test comment'
        click_button 'create_comment'

        assert(page.has_content?('Success'))
      end

      def test_notifying_admins
        me = create_user(email: 'foo@workarea.com')

        create_user(
          first_name: 'Bar',
          last_name: 'Baby',
          email: 'bar@workarea.com'
        )

        create_user(
          first_name: 'Baz',
          last_name: 'Bat',
          email: 'baz@workarea.com',
          admin: true
        )

        visit admin.user_path(me)

        click_link 'Comments'

        find_field('comment[body]').send_keys(['@'])

        refute_text('Bar Baby')
        assert(page.has_content?('Baz Bat'))

        find('.tribute-container li', text: 'Baz Bat (baz@workarea.com)').click
        click_button 'create_comment'

        assert(page.has_content?('Success'))
      end

      def test_subscribing_to_comments
        user = create_user(email: 'bcrouse-test@workarea.com')
        visit admin.user_path(user)

        click_link 'Comments'
        click_link t('workarea.admin.comments.index.subscribe')
        assert(page.has_content?('Success'))

        click_link t('workarea.admin.comments.index.unsubscribe')
        assert(page.has_content?('Success'))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/system/workarea/admin/comments_system_test.rb
workarea-admin-3.5.26 test/system/workarea/admin/comments_system_test.rb
workarea-admin-3.5.25 test/system/workarea/admin/comments_system_test.rb
workarea-admin-3.5.23 test/system/workarea/admin/comments_system_test.rb
workarea-admin-3.5.22 test/system/workarea/admin/comments_system_test.rb
workarea-admin-3.5.21 test/system/workarea/admin/comments_system_test.rb
workarea-admin-3.5.20 test/system/workarea/admin/comments_system_test.rb