---
title: "test controller at console"
author: "夜鸣猪"
date: "2013-02-15T00:03:11Z"
tags: []
categories: ["编程语言"]
slug: "test-controller-at-console"
draft: false
lastmod: "2013-02-15T00:03:11Z"
id: 1798129
url: "https://hlee.iteye.com/blog/1798129"
---

```ruby

#If method is POST method then

app.post'controller/action?parameter1=value1&parameter2=value2'
#[ here parameters will be as per your applicability ]

#else if it is GET method then

app.get'controller/action'


foo = ActionController::Base::ApplicationController.new
foo.some_method 

app.myresource_path
app.myresource_url


foo = ActionView::Base.new
foo.javascript_include_tag 'myscript'
or
helper.link_to "foo", "bar"


$ ./script/console
>> helper.number_to_currency('123.45')
=> "R$ 123,45"

> app.get '/posts/1'
> response = app.response
# you now have a rails response object much like the integration tests

> response.body            # get you the HTML
> response.cookies         # hash of the cookies

```