<commit_before>require 'spec_helper'

feature "Financial Disclosures", js: true do
  let(:author) { FactoryGirl.create :user }
  let(:journal) { FactoryGirl.create :journal }
  let(:paper) { FactoryGirl.create :paper, :with_tasks, user: author, journal: journal }

  before do
    paper.phases.last.tasks.create!(type: "FinancialDisclosure::Task")
    sign_in_page = SignInPage.visit
    sign_in_page.sign_in author
  end

  scenario "first funder" do
    edit_paper = EditPaperPage.visit paper

    edit_paper.view_card 'Financial Disclosure' do |overlay|
      expect(overlay.received_no_funding).to be_checked
      expect(overlay).to_not have_content('.dataset')
      overlay.received_funding.click
      expect(overlay.dataset).to be_visible
    end
  end

  scenario "navigate to authors card and back" do
    edit_paper = EditPaperPage.visit paper

    edit_paper.view_card 'Financial Disclosure' do |overlay|
      overlay.received_funding.click
      find('a', text: 'Add author').click
      expect(page).to have_content 'Add Authors'
      all('.overlay-close-button').first.click
      expect(page).to have_content 'Financial Disclosures'<commit_msg>Mark add author spec as pending<commit_after>require 'spec_helper'

feature "Financial Disclosures", js: true do
  let(:author) { FactoryGirl.create :user }
  let(:journal) { FactoryGirl.create :journal }
  let(:paper) { FactoryGirl.create :paper, :with_tasks, user: author, journal: journal }

  before do
    paper.phases.last.tasks.create!(type: "FinancialDisclosure::Task")
    sign_in_page = SignInPage.visit
    sign_in_page.sign_in author
  end

  scenario "first funder" do
    edit_paper = EditPaperPage.visit paper

    edit_paper.view_card 'Financial Disclosure' do |overlay|
      expect(overlay.received_no_funding).to be_checked
      expect(overlay).to_not have_content('.dataset')
      overlay.received_funding.click
      expect(overlay.dataset).to be_visible
    end
  end

  scenario "navigate to authors card and back" do
    pending "Waiting on discussion about how to visually implement adding authors to funding sources"
    edit_paper = EditPaperPage.visit paper

    edit_paper.view_card 'Financial Disclosure' do |overlay|
      overlay.received_funding.click
      find('a', text: 'Add author').click
      expect(page).to have_content 'Add Authors'
      all('.overlay-close-button').first.click
      expect(page).to have_content 'Financial Disclosures'
{'fraction_non_alphanumeric': 0.0964840556009812, 'fraction_numerical': 0.0, 'mean_word_length': 4.076763485477178, 'pattern_counts': {'":': 0, '<': 3, '<?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': '984936', 'n_tokens_mistral': 754, 'n_tokens_neox': 716, 'n_words': 182}