<commit_before># frozen_string_literal: true

require 'rails_helper'

describe 'creating a draft', js: true do
  before :each do
    login_as(create :user, :staff)
    visit '/forms'
    click_link 'New form'
    fill_in 'form_draft[name]', with: '<NAME>'
    fill_in 'form_draft[email]', with: '<EMAIL>'
    fill_in 'form_draft[fields_attributes][0][prompt]', with: 'When?'
    select 'date', from: 'form_draft[fields_attributes][0][data_type]'
  end
  context 'saving a draft' do
    before :each do
      click_button 'Save draft and preview changes'
      expect(page).to have_text 'When?'
    end
    context 'without publishing the form' do
      it 'displays it on the index page for later' do
        click_button 'Save draft & go back to index'
        expect(page).to have_css 'h1', text: 'Unpublished Drafts'
        expect(page).to have_text 'General Fletcher'<commit_msg>button not a link<commit_after># frozen_string_literal: true

require 'rails_helper'

describe 'creating a draft', js: true do
  before :each do
    login_as(create :user, :staff)
    visit '/forms'
    click_link 'New form'
    fill_in 'form_draft[name]', with: '<NAME>'
    fill_in 'form_draft[email]', with: '<EMAIL>'
    fill_in 'form_draft[fields_attributes][0][prompt]', with: 'When?'
    select 'date', from: 'form_draft[fields_attributes][0][data_type]'
  end
  context 'saving a draft' do
    before :each do
      click_button 'Save draft and preview changes'
      expect(page).to have_text 'When?'
    end
    context 'without publishing the form' do
      it 'displays it on the index page for later' do
        click_link 'Save draft & go back to index'
        expect(page).to have_css 'h1', text: 'Unpublished Drafts'
        expect(page).to have_text 'General Fletcher'
{'fraction_non_alphanumeric': 0.11186440677966102, 'fraction_numerical': 0.003389830508474576, 'mean_word_length': 3.735294117647059, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4894977', 'n_tokens_mistral': 574, 'n_tokens_neox': 555, 'n_words': 184}