Thanks for the quick reply - <br><br>I would be looking for a way to easily specify the most common types in shorthand, but have the ability to specify full HTTP headers if I want to.&nbsp; Ideally I would look for a third parameter in the get/post/put/delete methods that accepts a hash of http headers like 
<a href="http://api.rubyonrails.org/classes/ActionController/Integration/Session.html#M000083">http://api.rubyonrails.org/classes/ActionController/Integration/Session.html#M000083</a>.&nbsp; The spec might look like:<br><br><pre>
<span class="ident">context</span> <span class="punct">&quot;</span><span class="string">A get to /index</span><span class="punct">&quot;</span> <span class="keyword">do</span><span class="keyword"></span><br><br>  <span class="ident">
specify</span> <span class="punct">&quot;</span><span class="string">from a browser should show html</span><span class="punct">&quot;</span> <span class="keyword">do</span><br>    get :index<br>    # should statements... &nbsp;
<span class="keyword"></span><br>&nbsp;<span class="keyword"> end</span><br><br>  <span class="ident">specify</span> <span class="punct">&quot;</span><span class="string">in xml format should render xml</span><span class="punct">
&quot;</span> <span class="keyword">do</span><br>    get :index, {}, {:content_type=&gt;'application/xml', :accept =&gt; 'application/xml'}<br>    # should statements... &nbsp;<span class="keyword"><br>  end</span><br><br><span class="keyword">
end</span>
</pre>It seems like the convention in rails right now is to request rss and atom feeds by using the .rss/.atom extensions and changing the 'accepts' header in application.rb - so that leaves us with 4 fairly standard request types: html, javascript, xml and mobile devices (which I know little about).&nbsp; Since these will be so common, some syntactic sugar would be nice as well - maybe something like:
<br><pre><span class="ident">context</span> <span class="punct">&quot;</span><span class="string">A get to /index</span><span class="punct">&quot;</span> <span class="keyword">do</span><span class="keyword"></span><br><br>
  <span class="ident">specify</span> <span class="punct">&quot;</span><span class="string">from an ajax call should render rjs</span><span class="punct">&quot;</span> <span class="keyword">do</span><br>    get :index, {}, :format =&gt; :js # where the magic word 'format' correctly sets the accept header
<span class="keyword"><br></span>    # should statements... &nbsp;<span class="keyword"></span><br><span class="keyword">  end</span><span style="font-family: arial,sans-serif;"><br><br>end<br></span></pre>
References:<br>

<ul><li><a href="http://www.loudthinking.com/arc/000572.html">http://www.loudthinking.com/arc/000572.html</a></li></ul>I'd love to see these generators and plugins become part of core, too.&nbsp; After working with RSpec for a few days now, I doubt I'll ever go back to the unit and functional tests.&nbsp; Thanks for the hard work - 
<br><br>Jeff<br><br><br><div><span class="gmail_quote">On 10/28/06, <b class="gmail_sendername">David Chelimsky</b> &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On 10/28/06, Jeff Dean &lt;<a href="mailto:jeff@jefdean.com">jeff@jefdean.com</a>&gt; wrote:<br>&gt; Is anyone using RSpec with RESTful rails apps?&nbsp;&nbsp;In my rails controllers I<br>&gt; check request.respond_to? and render different views accordingly.
<br>&gt;<br>&gt; I noticed that the get method in the rails plugin doesn't accept headers:<br>&gt;<br>&gt; controller_mixin.rb line 92<br>&gt; def get(action, parameters = nil)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @request.env['REQUEST_METHOD'] = 'GET'
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; process action, parameters<br>&gt; end<br>&gt;<br>&gt; Has anyone found a way around this?<br><br>Hi Jeff. We're getting ready to release a new version of the plugin so<br>now is a good time to at least consider addressing this. Can you write
<br>an example of how you'd want to be able to write the spec (and<br>controller code) for a restful get request? Don't worry about how<br>rspec would do it. I just want to know what you want it to do.<br><br>Thanks,<br>David
<br><br>&gt;<br>&gt; Jeff<br>&gt;<br>&gt; _______________________________________________<br>&gt; Rspec-users mailing list<br>&gt; <a href="mailto:Rspec-users@rubyforge.org">Rspec-users@rubyforge.org</a><br>&gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users">
http://rubyforge.org/mailman/listinfo/rspec-users</a><br>&gt;<br>&gt;<br>_______________________________________________<br>Rspec-users mailing list<br><a href="mailto:Rspec-users@rubyforge.org">Rspec-users@rubyforge.org</a>
<br><a href="http://rubyforge.org/mailman/listinfo/rspec-users">http://rubyforge.org/mailman/listinfo/rspec-users</a><br></blockquote></div><br>