editor_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. require 'rails_helper'
  2. RSpec.describe 'Public Knowledge Base for editor', type: :system, authenticated: true do
  3. include_context 'basic Knowledge Base'
  4. before do
  5. published_answer && draft_answer && internal_answer
  6. end
  7. context 'homepage' do
  8. before { visit help_no_locale_path }
  9. it { expect(page).to have_editor_bar }
  10. it 'expect to have edit button' do
  11. button = find '.topbar-btn'
  12. expect(button['href']).to match(/edit$/)
  13. end
  14. end
  15. context 'category' do
  16. before { visit help_category_path(primary_locale.system_locale.locale, category) }
  17. it 'shows published answer' do
  18. within '.main' do
  19. expect(page).to have_selector(:link_containing, published_answer.translation.title)
  20. end
  21. end
  22. it 'shows draft answer' do
  23. within '.main' do
  24. expect(page).to have_selector(:link_containing, draft_answer.translation.title)
  25. end
  26. end
  27. it 'shows internal answer' do
  28. within '.main' do
  29. expect(page).to have_selector(:link_containing, internal_answer.translation.title)
  30. end
  31. end
  32. end
  33. end