On Mon, Jan 16, 2012 at 2:13 PM, Matt Jones <[email protected]> wrote:

>
> On Jan 15, 3:55 pm, Peter Vandenabeele <[email protected]> wrote:
> > I upgraded a small project that I had created on 3.1.3 to 3.2.0.rc2.
> >
> > Running rspec on it brings about a large amount of these messages:
> >
> > DEPRECATION WARNING: Passing a template handler in the template name is
> > deprecated. You can simply remove the handler name or pass render
> :handlers
> > => [:haml] instead. (called from block (2 levels) in <top (required)> at
> >
> /home/peterv/data/backed_up/projects/code/contact_app/spec/views/contacts/n
> ew.html.haml_spec.rb:12)
> > .
> >
> > The offending code seems to be:
> >
> > spec/views/contacts$ cat -n new.html.haml_spec.rb
> >      1    require 'spec_helper'
> >      2
> >      3    describe "contacts/new.html.haml" do
>
> Does it go away if you change this to "contacts/new.html"?
>

Thanks for the accurate reply :-)

With the change you suggested, I still get a deprecation (but it already
changed)

$ rspec spec/views/contacts/new.html.haml_spec.rb
DEPRECATION WARNING: Passing the format in the template name is deprecated.
Please pass render with :formats => [:html] instead. (called from block (2
levels) in <top (required)> at
/home/peterv/data/backed_up/customers/DDS/contact_app/spec/views/contacts/new.html.haml_spec.rb:12)


So, I went 1 step further, and moved to this:

-describe "contacts/new.html.haml" do
+describe "contacts/new" do

And now the result is OK:

contact_app$ rspec spec/views/contacts/new.html.haml_spec.rb
.

Finished in 0.18224 seconds
1 example, 0 failures

I assume it was clear that this is all "auto-generated" test code by rspec
initializer (that was 2.7 if I see correctly).

Now with rspec 2.8.x I added a new resource (foo), and I see that rspec
does it the correct way:

...
describe "foos/new" do
...

So, I presume this also shows the way towards the solution.

I now replaced all occurences of this {new|edit|index|show}.html.haml
into {new|edit|index|show} and all the deprecations are gone and all
tests remain green.

This _is_ fixed in rspec 2.8 , I believe with this commit:


https://github.com/rspec/rspec-rails/commit/1ccb17cfea27fe189c97cb88619b236e851b6fb9

I presume other users that have autogenerated rspec scaffold
tests will be hit by this? Anything can be done there (I asked the question
as
a comment on that patch on Github).

Thanks again,

Peter

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to