`

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
分享到:
评论

相关推荐

    Essential Linux Device Drivers

    Console Drivers Debugging Looking at the Sources Chapter 13. Audio Drivers Audio Architecture Linux-Sound Subsystem Device Example: MP3 Player Debugging Looking at the Sources Chapter 14. ...

    mini2440 beer(pwm) 驱动

    U-Boot 2012.07 (Aug 30 2012 - 21:55:43) +++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...[root@Liyong-zou /]#/home/test_beer please type operation: \0x09type 0 to exit \0x09type 1 to...

    spring-boot-reference.pdf

    Controller endpoints 50.9. Health Information 50.9.1. Auto-configured HealthIndicators 50.9.2. Writing Custom HealthIndicators 50.9.3. Reactive Health Indicators 50.9.4. Auto-configured ...

    ZendFramework中文文档

    7.5. 标准路由器:Zend_Controller_Router_Rewrite 7.5.1. 简介 7.5.2. 使用路由器 7.5.3. 基本的Rewrite路由器操作 7.5.4. 缺省路由 7.5.5. 基本 URL 和子目录 7.5.6. Route Types 7.5.6.1. Zend_Controller...

    Laraboot: Laravel 5 For Beginners

    Command Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 ...

    CE中文版-启点CE过NP中文.exe

    Tutorial Game: Added a secondary test Compare memory: Added a limit to the number of address values shown per row (can be changed) Address List: When the option to deactivate children is set, the ...

    ros by example for indigo volume 2

    当前大多数搞机器人开发的用户所装的ROS是indigo版本,而且是基于Ubuntu14.04的。如果你跑别的版本的rbx代码老出错,不用怀疑,就是代码版本问题!ros by example for indigo volume 1很多地方(包括CSDN)都可以...

    python3.6.5参考手册 chm

    PEP 528: Change Windows console encoding to UTF-8 PEP 520: Preserving Class Attribute Definition Order PEP 468: Preserving Keyword Argument Order New dict implementation PEP 523: Adding a frame ...

Global site tag (gtag.js) - Google Analytics