<commit_before>require 'spec_helper'

describe Hideable::ActiveRecord do

  let(:hidden_post) { Post.create(:hidden_at => DateTime.new(2022,10,10,10,10,10,'+0')) }
  let(:visible_post) { Post.create }
  
  describe '.hideable' do
    it 'adds instance methods to class when called' do
      Attachment.included_modules.should include Hideable::ActiveRecord::InstanceMethods
    end
    it 'adds class methods to class when called' do
      [:hideable, :hidden, :visible].all? { |m| Attachment.methods.include?(m) }
    end
    it 'adds hide_dependent class_attribute with correct value when hideable macro is used' do
      Post.hide_dependent.should be_true
      Attachment.hide_dependent.should be_false<commit_msg>Fix class method test<commit_after>require 'spec_helper'

describe Hideable::ActiveRecord do

  let(:hidden_post) { Post.create(:hidden_at => DateTime.new(2022,10,10,10,10,10,'+0')) }
  let(:visible_post) { Post.create }
  
  describe '.hideable' do
    it 'adds instance methods to class when called' do
      Attachment.included_modules.should include Hideable::ActiveRecord::InstanceMethods
    end
    it 'adds class methods to class when called' do
      methods = [:hideable, :hidden, :not_hidden]
      methods.all? { |m| Attachment.methods.include?(m) }.should be_true
    end
    it 'adds hide_dependent class_attribute with correct value when hideable macro is used' do
      Post.hide_dependent.should be_true
      Attachment.hide_dependent.should be_false
{'fraction_non_alphanumeric': 0.09959623149394348, 'fraction_numerical': 0.020188425302826378, 'mean_word_length': 4.329749103942652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5094099', 'n_tokens_mistral': 469, 'n_tokens_neox': 445, 'n_words': 122}