Rspec + Callbacks Classes

Hello Friends,

I am using rspec for testing my model, and I have used callbacks in my model as things are working as expected on the front end. but when I try to test the application it throws an error.

My code.

class MyModel < ActiveRecord::Base

after_create CreateProfileCallBacks

end

Friends any clue still struggling. :frowning:

anObjectNotAmethodStringOrBlock=CreateProfileCallBacks.new

Hey Abhi, I think you try evaluating the code directly as a string,
eg: before_destroy 'self.class.delete_all "parent_id = #{id}"'

Hope this helps.

Aashish