I''m attempting to write a test that verifies that the response body has expected data within it. The following works fine: response.should render_template(''index'') response.should be_success However: response.should have_tag("div") fails For some reason the value of response.body is " " (A string containing a single space) Does anyone have any thoughts on what the problem might be here? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081209/a07b8928/attachment.html>
Are you integrating your views? Rspec doesn''t render views by default. Instead, you can use a view spec for that. Mike On Dec 9, 2008, at 6:34 PM, George Deglin wrote:> I''m attempting to write a test that verifies that the response body > has expected data within it. > > The following works fine: > response.should render_template(''index'') > response.should be_success > > However: > response.should have_tag("div") fails > > For some reason the value of response.body is " " (A string > containing a single space) > > Does anyone have any thoughts on what the problem might be here? > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
Yeah. I just realized that myself. I''d like to be able to just make sure that the view renders successfully (No erb statements inside of the view fail). It would be nice to be able to test that inside of a controller spec if that''s possible. On Tue, Dec 9, 2008 at 3:42 PM, Mike Mangino <mmangino at elevatedrails.com>wrote:> Are you integrating your views? Rspec doesn''t render views by default. > Instead, you can use a view spec for that. > > Mike > > > On Dec 9, 2008, at 6:34 PM, George Deglin wrote: > > I''m attempting to write a test that verifies that the response body has >> expected data within it. >> >> The following works fine: >> response.should render_template(''index'') >> response.should be_success >> >> However: >> response.should have_tag("div") fails >> >> For some reason the value of response.body is " " (A string containing a >> single space) >> >> Does anyone have any thoughts on what the problem might be here? >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk >> > > -- > Mike Mangino > http://www.elevatedrails.com > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081209/eccfef28/attachment.html>
Looks like using the integrate_views method was indeed what I was seeking to use. Thanks. George On Tue, Dec 9, 2008 at 3:48 PM, George Deglin <george at xapblog.com> wrote:> Yeah. I just realized that myself. I''d like to be able to just make sure > that the view renders successfully (No erb statements inside of the view > fail). It would be nice to be able to test that inside of a controller spec > if that''s possible. > > > On Tue, Dec 9, 2008 at 3:42 PM, Mike Mangino <mmangino at elevatedrails.com>wrote: > >> Are you integrating your views? Rspec doesn''t render views by default. >> Instead, you can use a view spec for that. >> >> Mike >> >> >> On Dec 9, 2008, at 6:34 PM, George Deglin wrote: >> >> I''m attempting to write a test that verifies that the response body has >>> expected data within it. >>> >>> The following works fine: >>> response.should render_template(''index'') >>> response.should be_success >>> >>> However: >>> response.should have_tag("div") fails >>> >>> For some reason the value of response.body is " " (A string containing a >>> single space) >>> >>> Does anyone have any thoughts on what the problem might be here? >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>> >> >> -- >> Mike Mangino >> http://www.elevatedrails.com >> >> >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20081209/88b0127c/attachment.html>