Я новичок в rspec
.Я пытаюсь написать тестовые примеры для изображения, которое загружено с помощью скрепки.Я просто загружаю изображение в свой пост, оно отлично показывает изображение на странице моего приложения rails.Когда я удаляю этот файл изображения из базы данных (Railsapp / public / images), журнал показывает:
[ActionController::RoutingError (No route matches [GET] "/system/posts/images/000/000/116/original/Screenshot_%281%29.png"):] but show page does not shows any error page. How can i handle while writing spec for controller?
Started GET "/system/posts/images/000/000/116/original/Screenshot_%281%29.png?1549989477" for 127.0.0.1 at 2019-02-12 22:46:03 +0530
ActionController::RoutingError (No route matches [GET] "/system/posts/images/000/000/116/original/Screenshot_%281%29.png"):
actionpack (5.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:65:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.2) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.2) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.2) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.2) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.2) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.2.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (5.2.2) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.6) lib/rack/method_override.rb:22:in `call'
rack (2.0.6) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.2) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.0.6) lib/rack/sendfile.rb:111:in `call'
rack-mini-profiler (1.0.1) lib/mini_profiler/profiler.rb:281:in `call'
railties (5.2.2) lib/rails/engine.rb:524:in `call'
puma (3.12.0) lib/puma/configuration.rb:225:in `call'
puma (3.12.0) lib/puma/server.rb:658:in `handle_request'
puma (3.12.0) lib/puma/server.rb:472:in `process_client'
puma (3.12.0) lib/puma/server.rb:332:in `block in run'
puma (3.12.0) lib/puma/thread_pool.rb:133:in `block in spawn_thread'
Started GET "/topics/1/posts/116/mark_as_read" for 127.0.0.1 at 2019-02-12 22:46:03 +0530
Processing by PostsController#mark_as_read as */*
Parameters: {"topic_id"=>"1", "id"=>"116"}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 3], ["LIMIT", 1]]
↳ C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/bundler/gems/remotipart-88d9a7d55bde/lib/remotipart/middleware.rb:32
Topic Load (0.4ms) SELECT "topics".* FROM "topics" WHERE "topics"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
↳ app/controllers/posts_controller.rb:69
Post Load (0.5ms) SELECT "posts".* FROM "posts" WHERE "posts"."topic_id" = ? AND "posts"."id" = ? LIMIT ? [["topic_id", 1], ["id", 116], ["LIMIT", 1]]
↳ app/controllers/posts_controller.rb:74
User Exists (0.3ms) SELECT 1 AS one FROM "users" INNER JOIN "posts_users" ON "users"."id" = "posts_users"."user_id" WHERE "posts_users"."post_id" = ? AND "users"."id" = ? LIMIT ? [["post_id", 116], ["id", 3], ["LIMIT", 1]]
↳ app/controllers/posts_controller.rb:20
No template found for PostsController#mark_as_read, rendering head :no_content
Completed 204 No Content in 12225ms (ActiveRecord: 4.1ms)