doug livesey
2009-Feb-07 11:16 UTC
[rspec-users] Speccing the format portion of a controller
Hi -- I have a hacky work-around for this, but wondered if anyone could tell me the canonical way of sending the get/put/etc. portion of a spec with format information.I guess with something that might look like this: def do_get get :index, :format => :xml end Cheers, Doug. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090207/83d5282a/attachment.html>
David Chelimsky
2009-Feb-07 12:41 UTC
[rspec-users] Speccing the format portion of a controller
On Sat, Feb 7, 2009 at 5:16 AM, doug livesey <biot023 at gmail.com> wrote:> Hi -- I have a hacky work-around for this, but wondered if anyone could tell > me the canonical way of sending the get/put/etc. portion of a spec with > format information.This is what is in the specs generated by rspec-rails: request.env["HTTP_ACCEPT"] = "application/xml" get :index HTH, David> I guess with something that might look like this: > def do_get > get :index, :format => :xml > end > Cheers, > Doug. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
doug livesey
2009-Feb-07 16:00 UTC
[rspec-users] Speccing the format portion of a controller
Cheers for that -- that''s what I thought was the hacky solution! ;)I''m now reassured that I''m not being evil -- thanks! Doug. 2009/2/7 David Chelimsky <dchelimsky at gmail.com>> On Sat, Feb 7, 2009 at 5:16 AM, doug livesey <biot023 at gmail.com> wrote: > > Hi -- I have a hacky work-around for this, but wondered if anyone could > tell > > me the canonical way of sending the get/put/etc. portion of a spec with > > format information. > > This is what is in the specs generated by rspec-rails: > > request.env["HTTP_ACCEPT"] = "application/xml" > get :index > > HTH, > David > > > I guess with something that might look like this: > > def do_get > > get :index, :format => :xml > > end > > Cheers, > > Doug. > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090207/19d4cd84/attachment-0001.html>
David Chelimsky
2009-Feb-07 16:14 UTC
[rspec-users] Speccing the format portion of a controller
On Feb 7, 2009, at 10:00 AM, doug livesey <biot023 at gmail.com> wrote:> Cheers for that -- that''s what I thought was the hacky solution! ;) > I''m now reassured that I''m not being evil -- thanks!Not so fast! It works, and it''s what rspec uses, but that doesn''t make it good ( as opposed to evil ). I''d add support for something friendlier, but maybe it really belongs in rails proper.> Doug. > > 2009/2/7 David Chelimsky <dchelimsky at gmail.com> > On Sat, Feb 7, 2009 at 5:16 AM, doug livesey <biot023 at gmail.com> > wrote: > > Hi -- I have a hacky work-around for this, but wondered if anyone > could tell > > me the canonical way of sending the get/put/etc. portion of a spec > with > > format information. > > This is what is in the specs generated by rspec-rails: > > request.env["HTTP_ACCEPT"] = "application/xml" > get :index > > HTH, > David > > > I guess with something that might look like this: > > def do_get > > get :index, :format => :xml > > end > > Cheers, > > Doug. > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090207/25a42f77/attachment.html>
Pat Maddox
2009-Feb-07 16:20 UTC
[rspec-users] Speccing the format portion of a controller
On Sat, Feb 7, 2009 at 3:16 AM, doug livesey <biot023 at gmail.com> wrote:. def do_get get :index, :format => "xml" end should work. Notice it''s a string instead of symbol. Pat
doug livesey
2009-Feb-07 17:33 UTC
[rspec-users] Speccing the format portion of a controller
Well, I can guarantee that it''s better than any home-grown solution I would attempt, so I''ll be happy w/ that for now! ;)Cheers again, Doug. 2009/2/7 David Chelimsky <dchelimsky at gmail.com>> On Feb 7, 2009, at 10:00 AM, doug livesey <biot023 at gmail.com> wrote: > > Cheers for that -- that''s what I thought was the hacky solution! ;)I''m now > reassured that I''m not being evil -- thanks! > > > Not so fast! It works, and it''s what rspec uses, but that doesn''t make it > good ( as opposed to evil ). > > I''d add support for something friendlier, but maybe it really belongs in > rails proper. > > Doug. > > 2009/2/7 David Chelimsky < <dchelimsky at gmail.com>dchelimsky at gmail.com> > >> On Sat, Feb 7, 2009 at 5:16 AM, doug livesey < <biot023 at gmail.com> >> biot023 at gmail.com> wrote: >> > Hi -- I have a hacky work-around for this, but wondered if anyone could >> tell >> > me the canonical way of sending the get/put/etc. portion of a spec with >> > format information. >> >> This is what is in the specs generated by rspec-rails: >> >> request.env["HTTP_ACCEPT"] = "application/xml" >> get :index >> >> HTH, >> David >> >> > I guess with something that might look like this: >> > def do_get >> > get :index, :format => :xml >> > end >> > Cheers, >> > Doug. >> > _______________________________________________ >> > rspec-users mailing list >> > <rspec-users at rubyforge.org>rspec-users at rubyforge.org >> > <http://rubyforge.org/mailman/listinfo/rspec-users> >> http://rubyforge.org/mailman/listinfo/rspec-users >> > >> _______________________________________________ >> rspec-users mailing list >> <rspec-users at rubyforge.org>rspec-users at rubyforge.org >> <http://rubyforge.org/mailman/listinfo/rspec-users> >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090207/b501550c/attachment-0001.html>
David Chelimsky
2009-Feb-07 18:54 UTC
[rspec-users] Speccing the format portion of a controller
On Sat, Feb 7, 2009 at 10:20 AM, Pat Maddox <pergesu at gmail.com> wrote:> On Sat, Feb 7, 2009 at 3:16 AM, doug livesey <biot023 at gmail.com> wrote:. > > def do_get > get :index, :format => "xml" > end > > should work. Notice it''s a string instead of symbol.I should change the gen''d specs then. That''s simpler, ay?> > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
doug livesey
2009-Feb-08 14:11 UTC
[rspec-users] Speccing the format portion of a controller
Groovy!Cheers, Doug. 2009/2/7 David Chelimsky <dchelimsky at gmail.com>> On Sat, Feb 7, 2009 at 10:20 AM, Pat Maddox <pergesu at gmail.com> wrote: > > On Sat, Feb 7, 2009 at 3:16 AM, doug livesey <biot023 at gmail.com> wrote:. > > > > def do_get > > get :index, :format => "xml" > > end > > > > should work. Notice it''s a string instead of symbol. > > I should change the gen''d specs then. That''s simpler, ay? > > > > > Pat > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090208/68bf5d76/attachment.html>