[Ruby 1.8.7, Rails 3.0]
I want to call annotation_categories/add_annotation_category.js.erb
with the action add_annotation_category
.
It works well with an Ajax request, but it doesn't work in my tests.
I know that the problem comes from :formats => [:html]
which should be :formats => [:js]
, but I don't understand why I have this behavior with .js.erb
and not with rjs
(I'm moving from Prototype to jQuery).
In the Controller:
def add_annotation_category
@assignment = Assignment.find(params[:assignment_id])
end
In ControllerTest:
get_as @admin,
:add_annotation_category,
:assignment_id => @assignment.id
I have this Error:
1) Error:
test: An admin on :add_annotation_category should without errors. (AnnotationCategoriesControllerTest):
ActionView::MissingTemplate: Missing template annotation_categories/add_annotation_category with {:handlers=>[:rxml, :rjs, :rhtml, :builder, :erb], :locale=>[:en, :en], :formats=>[:html]} in view paths "/Users/GhiGt/Projects/MarkUsProject/app/views", "/Users/GhiGt/Projects/MarkUsProject/vendor/plugins/calendar_date_select/app/views", "/Users/GhiGt/Projects/MarkUsProject/vendor/plugins/auto_complete/app/views", "/Users/GhiGt/Projects/MarkUsProject/vendor/plugins/ssl_requirement/app/views"
test/functional/authenticated_controller_test.rb:10:in `get_as'
test/functional/annotation_categories_controller_test.rb:262:in `__bind_1374736360_769164'