<commit_before># -*- encoding : utf-8 -*-
require 'spec_helper'

RSpec.configure do |config|
  config.use_transactional_fixtures = false
end

describe DealsController, :js => true do
  fixtures :users, :accounts, :preferences
  set_fixture_class  :accounts => Account::Base

  before do
    Deal::Base.destroy_all
  end

  include_context "太郎 logged in"

  describe "カレンダー（翌月）のクリック" do
    let(:target_month) {(Date.today >> 1).month}
    before do
      click_link '家計簿'
      click_link "#{target_month}月"
    end

    it "カレンダーの選択月が翌月に変わる" do
      find("td.selected_month").text.should == "#{target_month}月"
    end
  end

  describe "登録" do

    describe "通常明細" do
      before do
        visit "/deals" # 今月へ。日付は入っているはず
        fill_in 'deal_summary', :with => '朝食のおにぎり'
        fill_in 'deal_debtor_entries_attributes_0_amount', :with => '210'
        select '現金', :from => 'deal_creditor_entries_attributes_0_account_id'
        select '食費', :from => 'deal_debtor_entries_attributes_0_account_id'
        click_button '記入'
      end

      it do
        page.should have_content('追加しました。')
        page.should have_content('朝食のおにぎり')
      end
    end<commit_msg>[#40028583] Add a spec for clicking the today area.<commit_after># -*- encoding : utf-8 -*-
require 'spec_helper'

RSpec.configure do |config|
  config.use_transactional_fixtures = false
end

describe DealsController, :js => true do
  fixtures :users, :accounts, :preferences
  set_fixture_class  :accounts => Account::Base

  before do
    Deal::Base.destroy_all
  end

  include_context "太郎 logged in"

  describe "今日エリアのクリック" do
    let(:target_month) {(Date.today << 1).month}
    before do
      # 前月にしておいて
      click_link '家計簿'
      click_link "#{target_month}月"

      # クリック
      find("#user_and_today").click
    end

    it "カレンダーの選択月が今月に変わり、今日の日付が入る" do
      find("td.selected_month").text.should == "#{Date.today.month}月"
      find("input#date_day").value.should == Date.today.day.to_s
    end

  end

  describe "カレンダー（翌月）のクリック" do
    let(:target_month) {(Date.today >> 1).month}
    before do
      click_link '家計簿'
      click_link "#{target_month}月"
    end

    it "カレンダーの選択月が翌月に変わる" do
      find("td.selected_month").text.should == "#{target_month}月"
    end
  end

  describe "登録" do

    describe "通常明細" do
      before do
        visit "/deals" # 今月へ。日付は入っているはず
        fill_in 'deal_summary', :with => '朝食のおにぎり'
        fill_in 'deal_debtor_entries_attributes_0_amount', :with => '210'
        select '現金', :from => 'deal_creditor_entries_attributes_0_account_id'
        select '食費', :from => 'deal_debtor_entries_attributes_0_account_id'
        click_button '記入'
      end

      it do
        page.should have_content('追加しました。')
        page.should have_content('朝食のおにぎり')
      end
    end
{'fraction_non_alphanumeric': 0.11560486757337152, 'fraction_numerical': 0.00894774516821761, 'mean_word_length': 3.056603773584906, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '2465510', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1102, 'n_words': 210}