Hi,
Does anyone have a snippet of code they use to setup and test an
extension
page’s render method?
class MapquestPage < Page
def render
# i’d like to create a unit test(s) to for this method.
end
def cache_page?
false
end
end
Todd
Hi,
Does anyone have a snippet of code they use to setup and test an
extension
page’s render method?
class MapquestPage < Page
def render
# i’d like to create a unit test(s) to for this method.
end
def cache_page?
false
end
end
Todd
Todd,
In a functional test, pass the pre-initialized @request and @response
objects to your page’s process method, like so:
@page.process(@request, @response)
Make sure that you have constructed the parameters correctly.
Alternatively you could do a ‘get’ request on the SiteController like
so:
@controller = SiteController.new
get :show_page, :url => @page.url
That assumes, of course, that your page is saved in the test database,
either from a fixture or manually.
Sean
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs