Hi,

On Fri, May 6, 2011 at 02:28, S Ahmed <sahmed1...@gmail.com> wrote:
> 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?

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
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to