Api (class/method) renaming, will a simple controller test verify this?

I want my tests to fail if I rename a method in my /lib folder in a
rails
app.

Say I have a class like:

/lib
/lib/formatter.rb

class Formatter
def self.do_transforms(text)
text
end
end

And say I reference this in my HomeController’s index action:

def index

text = params[:text]

text = Formatter.do_transforms(text)

end

Now if I was to rename the method from do_transforms to
perform_transforms,
what is the minimum test I would neeed to do on my HomeController to get
it
to fail b/c of the rename?

Hi,

On Fri, May 6, 2011 at 02:28, S Ahmed [email protected] wrote:

text

text = Formatter.do_transforms(text)

end

Now if I was to rename the method from do_transforms to perform_transforms,
what is the minimum test I would neeed to do on my HomeController to get it
to fail b/c of the rename?

The simplest test that would cover your specific case would probably be:

describe HomeController do
describe “GET ‘index’” do
it “succeeds” do
get :index
response.should be_success
end
end
end

If the method has been renamed, the index action will throw a
NoMethodError and that spec will fail.

Mike