<commit_before>require 'application_system_test_case'

class CasebookSystemTest < ApplicationSystemTestCase
  describe 'as an anonymous visitor' do
    scenario 'viewing a casebook', solr: true do
      visit casebook_path casebook = content_nodes(:public_casebook)
      assert_content casebook.title

      click_link (section_1 = content_nodes(:public_casebook_section_1)).title
      assert_content section_1.headnote

      click_link (resource_1 = content_nodes(:'public_casebook_section_1.1')).title
      assert_content resource_1.headnote
      assert_content resource_1.resource.title
      assert_content resource_1.resource.content
    end
  end


  describe 'as a registered user' do
    before do
      sign_in @user = users(:verified_professor)
    end

    scenario 'creating a casebook', solr: true do
      visit root_path

      click_link 'Create a casebook'

      fill_in 'Title', with: 'Test casebook title'
      fill_in 'Subtitle', with: 'Test casebook subtitle'
      fill_in 'Headnote', with: 'Test casebook headnote'

      click_button 'Save changes'

      assert_content 'Test casebook title'
      assert_content 'Test casebook subtitle'
      assert_content 'Test casebook headnote'
<commit_msg>Fix test to cover new spelling of name.<commit_after>require 'application_system_test_case'

class CasebookSystemTest < ApplicationSystemTestCase
  describe 'as an anonymous visitor' do
    scenario 'viewing a casebook', solr: true do
      visit casebook_path casebook = content_nodes(:public_casebook)
      assert_content casebook.title

      click_link (section_1 = content_nodes(:public_casebook_section_1)).title
      assert_content section_1.headnote

      click_link (resource_1 = content_nodes(:'public_casebook_section_1.1')).title
      assert_content resource_1.headnote
      assert_content resource_1.resource.title
      assert_content resource_1.resource.content
    end
  end


  describe 'as a registered user' do
    before do
      sign_in @user = users(:verified_professor)
    end

    scenario 'creating a casebook', solr: true do
      visit root_path

      click_link 'Create casebook'

      fill_in 'Title', with: 'Test casebook title'
      fill_in 'Subtitle', with: 'Test casebook subtitle'
      fill_in 'Headnote', with: 'Test casebook headnote'

      click_button 'Save changes'

      assert_content 'Test casebook title'
      assert_content 'Test casebook subtitle'
      assert_content 'Test casebook headnote'

{'fraction_non_alphanumeric': 0.06411290322580646, 'fraction_numerical': 0.007258064516129033, 'mean_word_length': 3.7528735632183907, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5424091', 'n_tokens_mistral': 722, 'n_tokens_neox': 706, 'n_words': 202}