Can Base#before_destroy not be deprecated?

I understand the motivation for deprecating it in actual application
code, but I ask because I’ve been testing my controller’s destroy
actions in specs as follows:

describe “POST destroy” do

it "should redirect to show with an alert on failed destroy" do
  ModelOfThisController.class_eval { def before_destroy; false;

end }
#rest of code…
end

it "should redirect to index with a notice on successful destroy"

do
ModelOfThisController.class_eval { def before_destroy; true;
end }
#rest of code…
end

end

And i thought it was a pretty clean way to accomplish the goal. If
you deprecate Base#before_destroy and then remove it in favor of
Base.before_destroy :method, Then what? Won’t I have to do the
equivalent to every method in the before_destroy callback chain?
Seems messier and more brittle.

Or is there a rails way of testing this that I don’t know about?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs