<commit_before>require 'association-reporter/assumption'

describe AssociationReporter::Assumption do

  describe AssociationReporter::ColumnAssumption do
    it 'provides column as a guess' do
    end

    it 'is valid for existing columns' do
    end

    it 'is invalid for non-existent columns' do
    end
  end

  describe AssociationReporter::AssociationAssumption do
    it 'provides the association name as a guess' do
    end

    it 'is valid if the association is a method on the provided class' do
    end

    it 'is invalid if the association is not a method on the provided class' do
    end
  end

  describe AssociationReporter::ModelTableAssumption do
    it 'provides a table name as the guess' do
    end

    it 'is valid if the table exists' do
    end

    it 'is invalid if the table does not exist' do
    end
  end

  describe AssociationReporter::ModelClassAssumption do
    it 'provides the class name as the guess' do
    end

    it 'provides the guessed class object if the class is defined' do
    end

    it 'is valid if the class is defined' do
    end

    it 'is invalid if the class is not defined' do
    end
  end

end<commit_msg>Add assumption tests<commit_after>require 'association-reporter/assumption'

describe AssociationReporter::Assumption do

  describe AssociationReporter::ColumnAssumption do
    it 'provides column as a guess' do
      col = described_class.new('articles', 'author_id')
      expect(col.guess).to eq('author_id')
    end

    it 'is valid for existing columns' do
      col = described_class.new('articles', 'author_id')
      expect(col).to be_valid
    end

    it 'is invalid for non-existent columns' do
      col = described_class.new('articles', 'foobar')
      expect(col).to_not be_valid
    end
  end

  describe AssociationReporter::AssociationAssumption do
    it 'provides the association name as a guess' do
      assoc = described_class.new(Article, :author)
      expect(assoc.guess).to eq(:author)
    end

    it 'is valid if the association is a method on the provided class' do
      assoc = described_class.new(Article, :author)
      expect(assoc).to be_valid
    end

    it 'is invalid if the association is not a method on the provided class' do
      assoc = described_class.new(Article, :foobar)
      expect(assoc).to_not be_valid
    end
  end

  describe AssociationReporter::ModelTableAssumption do
    it 'provides a table name as the guess' do
      table = described_class.new(Article)
      expect(table.guess).to eq('articles')
    end

    it 'is valid if the table exists' do
      table = described_class.new(Article)
      expect(table).to be_valid
    end

    it 'is invalid if the table does not exist' do
      NonExistent = Class.new
      table = described_class.new(NonExistent)
      expect(table).to_not be_valid
    end
  end

  describe AssociationReporter::ModelClassAssumption do
    it 'provides the class name as the guess' do
      model_class = described_class.new('Article')
      expect(model_class.guess).to eq('Article')
    end

    it 'provides the guessed class object if the class is defined' do
      model_class = described_class.new('Article')
      expect(model_class.klass_guess).to eq(Article)
    end

    it 'is valid if the class is defined' do
      model_class = described_class.new('Article')
      expect(model_class).to be_valid
    end

    it 'is invalid if the class is not defined' do
      model_class = described_class.new('FooBar')
      expect(model_class).to_not be_valid
    end
  end

end
{'fraction_non_alphanumeric': 0.06540738652382296, 'fraction_numerical': 0.0, 'mean_word_length': 3.0922722029988465, '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': '4220595', 'n_tokens_mistral': 1068, 'n_tokens_neox': 1007, 'n_words': 383}