<commit_before>require 'spec_helper'

describe Note do
  subject { build(:note) }

  before do
    Cloudinary::Uploader.stub destroy: true
  end

  describe 'validations' do
    it { should be_valid }
    it { should_not have_valid(:photo).when(nil) }<commit_msg>after_destroy hook<commit_after>require 'spec_helper'

describe Note do
  subject { build(:note) }

  describe 'validations' do
    it { should be_valid }
    it { should_not have_valid(:photo).when(nil) }
  end

  describe "callbacks" do
    describe "after_destroy" do
      subject { create(:note) }
      it "destroys attached files" do
        Cloudinary::Uploader.should_receive(:destroy).with(subject.photo.public_id)
        subject.destroy
      end
    end
{'fraction_non_alphanumeric': 0.09739368998628258, 'fraction_numerical': 0.0, 'mean_word_length': 3.506172839506173, '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': '1172239', 'n_tokens_mistral': 231, 'n_tokens_neox': 224, 'n_words': 57}