If your controller action looks like this:
respond_to do |format|
format.html { raise \'Unsupported\' }
format.js # index.js.erb
end
and yo
I had similar problem:
# controller
def create
respond_to do |format|
format.js
end
end
# test
test "call format js" do
record = promos(:one)
post some_url(record)
assert true
end
and the result was this:
> rails test
Error:
ActionController::UnknownFormat: ActionController::UnknownFormat
I fixed it with this adjusting to the test(adding headers):
test "call format js" do
record = promos(:one)
headers = { "accept" => "text/javascript" }
post some_url(record), headers: headers
assert true
end
rails (6.0.0.beta3)