# Extension test example?

**URL:** <https://www.ruby-forum.com/t/extension-test-example/85146>\
**Category:** Radiant CMS\
**Created:** [February 10, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/extension-test-example/85146 "2007-02-10T16:16:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [February 10, 2007, 4:16pm UTC](https://www.ruby-forum.com/t/extension-test-example/85146/1 "2007-02-10T16:16:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [February 10, 2007, 7:57pm UTC](https://www.ruby-forum.com/t/extension-test-example/85146/2 "2007-02-10T19:57:40Z")

</div>

Cool, I get it, thanks Sean

Quoting Sean C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Todd\_McGrath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@Todd\_McGrath](https://www.ruby-forum.com/u/Todd_McGrath)\
**Post date:** [February 10, 2007, 5:24pm UTC](https://www.ruby-forum.com/t/extension-test-example/85146/3 "2007-02-10T17:24:31Z")

</div>

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
