<commit_before>require 'rails_helper'

describe Event, type: :model do

  let(:event){ build(:event) }

  describe 'associations' do
    it { is_expected.to belong_to :place }
    it { is_expected.to belong_to :user }
    it { is_expected.to belong_to :price }
    it { is_expected.to belong_to :persona }
    it { is_expected.to belong_to :subcategory }
    it { is_expected.to have_and_belong_to_many :categories }
    it { is_expected.to have_and_belong_to_many :weeks }
    it { is_expected.to have_many :agendas }
    it { is_expected.to have_many :agended_by }
    it { is_expected.to have_many :tips }
  end

  describe 'validations' do
    it { is_expected.to validate_presence_of :name }
    it { is_expected.to validate_presence_of :date_start }
    it { is_expected.to validate_presence_of :hour_start_first }
  end

  describe '#create' do

    context 'event valid' do
      it 'should create event' do
        event = create(:event)

        event.save

        expect(event).to be_valid
      end
    end

    context 'event invalid' do
      it 'should NOT create event' do
        event = Event.new

        event.save

        expect(event).to_not be_valid
      end
    end
<commit_msg>#DEV20: Adjust in test of validate presence for "allday"<commit_after>require 'rails_helper'

describe Event, type: :model do

  let(:event){ build(:event) }

  describe 'associations' do
    it { is_expected.to belong_to :place }
    it { is_expected.to belong_to :user }
    it { is_expected.to belong_to :price }
    it { is_expected.to belong_to :persona }
    it { is_expected.to belong_to :subcategory }
    it { is_expected.to have_and_belong_to_many :categories }
    it { is_expected.to have_and_belong_to_many :weeks }
    it { is_expected.to have_many :agendas }
    it { is_expected.to have_many :agended_by }
    it { is_expected.to have_many :tips }
  end

  describe 'validations' do
    it { is_expected.to validate_presence_of :name }
    it { is_expected.to validate_presence_of :date_start }
  end

  describe '#create' do

    context 'event valid' do
      it 'should create event' do
        event = create(:event)

        event.save

        expect(event).to be_valid
      end
    end

    context 'event invalid' do
      it 'should NOT create event' do
        event = Event.new

        event.save

        expect(event).to_not be_valid
      end
    end

{'fraction_non_alphanumeric': 0.0812395309882747, 'fraction_numerical': 0.0008375209380234506, 'mean_word_length': 2.804140127388535, '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': '2612223', 'n_tokens_mistral': 804, 'n_tokens_neox': 773, 'n_words': 214}