测试完成后的回形针错误

时间:2016-05-15 10:46:30

标签: ruby-on-rails capybara paperclip dropzone.js

我在使用dropzone测试回形针时遇到问题。基本上测试工作100%正常,但在测试执行后它调用路由错误,因为应用程序没有找到当前在测试中处理的图像。我测试了创建的图像链接的正确性,它就在那里。
基本上我有这个测试:

let!(:announcement3) do    
  create(:announcement, announcement_images: [create(:announcement_image), create(:announcement_image)])
end
  it 'can set second image as primary' do
    login_as user, scope: :user
    visit edit_area_announcement_path(announcement3.slug)
    click_link I18n.t('simple_form.buttons.announcements.next')
    all('[data-primary="not_set"]')[1].click
    click_link I18n.t('simple_form.buttons.announcements.finish')
    expect(Announcement.last.main_image_index).to eq(Announcement.last.announcement_images.last.id)
  end

在此测试完成后,我收到此错误: 失败/错误:无法从回溯中找到匹配的行

 ActionController::RoutingError:
   No route matches [GET] "/home/vyivrain/Documents/Job/pets/public/system/announcement_images/images/000/000/001/original/synchronised-5th-generation-alliance-magni.jpg"
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:38:in `call_app'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in `block in call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `block in tagged'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:26:in `tagged'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/tagged_logging.rb:68:in `tagged'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/rack/logger.rb:20:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/request_id.rb:21:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/static.rb:120:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
 # ./app/middleware/rack/robots_middleware.rb:12:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:518:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/railties-4.2.6/lib/rails/application.rb:165:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/capybara-2.6.2/lib/capybara/server.rb:19:in `call'
 # /home/vyivrain/.rvm/gems/ruby-2.3.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'

我只是不知道为什么它会触发此网址并尝试查找此图片。从堆栈错误来看,只有robots_middleware.rb,但那只引用robots.txt,这是不可能的,错误就在那里。

感谢您的回答

0 个答案:

没有答案