test controller at console

#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

你可能感兴趣的:(controller)