# Notes controller
def index
...
respond_to do |format|
format.json { render :json => @notes }
end
end
# Notes functional test
params = {:format => 'json', :title => ...}
get :index, params
notes = JSON.parse(@response.body)
assert_equal note.title, notes[0]['note']['title']
Monday, September 13, 2010
Functional test for respond_to :json in Rails
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment