title: Capybara upload images issue
body: <p>I need to test file uploads page with Capybara and Selenium.</p>
  <p>I wrote this test:</p>
  <pre><code>require 'rails_helper'
  
  describe 'Images', type: :feature do
    before(:each) do
      @user = create(:user)
      visit '/users/sign_in'
      fill_in 'sing-in-email-input', with: @user.email
      fill_in 'sign-in-password-input', with: @user.password
      click_button 'btn-sign-in'
      visit '/categories'
      click_on 'btn-new-category'
      expect(current_path) == new_category_path
      fill_in 'category_name', with: 'Test'
      click_button 'btn-create category'
      visit '/categories'
      first('.fa', :visible =&gt; false).click
      expect(current_path) == category_path(id: Category.last.slug.to_s)
    end
  
    it 'should allow a registered user to create image and go to it page', js: true do
      click_on 'btn-upload-images'
      expect(current_path) == new_image_path(id: Category.last.slug.to_s)
      attach_file('image[image]',
                  File.join(Rails.root, '/spec/fixtures/solnce-kosmos-merkuriy.jpg'), :visible =&gt; false)
      click_on('btn-upload-img')
    end
  end
  </code></pre>
  <p>I am not able to continue write this test and check was this image successfully uploaded because on this line:</p>
  <blockquote>
  <p>click_on('btn-upload-img')</p>
  </blockquote>
  <p>I got this error:</p>
  <pre><code>Failure/Error: raise ActionController::RoutingError, &quot;No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}&quot;
       
       ActionController::RoutingError:
         No route matches [GET] &quot;/home/Anton-S/RubymineProjects/rails_projects/gallery/spec/support/uploads/image/image/8790/solnce-kosmos-merkuriy.jpg&quot;
       # /var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app'
       # /var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:24:in `block in call'
       # /var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:24:in `call'
       # /var/lib/gems/2.3.0/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'
       # /var/lib/gems/2.3.0/gems/rack-2.0.3/lib/rack/runtime.rb:22:in `call'
       # /var/lib/gems/2.3.0/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in `call'
       # /var/lib/gems/2.3.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
       # /var/lib/gems/2.3.0/gems/rack-2.0.3/lib/rack/urlmap.rb:68:in `block in call'
       # /var/lib/gems/2.3.0/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in `each'
       # /var/lib/gems/2.3.0/gems/rack-2.0.3/lib/rack/urlmap.rb:53:in `call'
       # /var/lib/gems/2.3.0/gems/capybara-2.16.1/lib/capybara/server.rb:44:in `call'
       # /var/lib/gems/2.3.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86:in `service'
       # ------------------
       # --- Caused by: ---
       # Capybara::CapybaraError:
       #   Your application server raised an error - It has been raised in your test code because Capybara.raise_server_errors == true
       #   /var/lib/gems/2.3.0/gems/capybara-2.16.1/lib/capybara/session.rb:145:in `raise_server_error!'
  
  Finished in 17.15 seconds (files took 2.55 seconds to load)
  133 examples, 1 failure
  
  Failed examples:
  
  rspec ./spec/features/images_spec.rb:20 # Images should allow a registered user to create image and go to it page
  </code></pre>
  <p>I have checked that I realy have this file</p>
  <p><em>/spec/fixtures/solnce-kosmos-merkuriy.jpg</em></p>
  <p>on the right place.</p>
  <p>Here is my <strong>/config/initializers/carrierwave.rb</strong></p>
  <pre><code>if Rails.env.test? || Rails.env.cucumber?
    CarrierWave.configure do |config|
      config.storage = :file
      config.enable_processing = false
    end
  
    # make sure our uploader is auto-loaded
    ImageUploader
  
    # use different dirs when testing
    CarrierWave::Uploader::Base.descendants.each do |klass|
      next if klass.anonymous?
      klass.class_eval do
        def cache_dir
          &quot;#{Rails.root}/spec/support/uploads/tmp&quot;
        end
  
        def store_dir
          &quot;#{Rails.root}/spec/support/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}&quot;
        end
      end
    end
  end
  </code></pre>
  <p>my <strong>rails_helper.rb</strong></p>
  <pre><code>require 'support/factory_bot'
  require 'spec_helper'
  require 'shoulda/matchers'
  require 'capybara/rspec'
  ENV['RAILS_ENV'] ||= 'test'
  require File.expand_path('../../config/environment', __FILE__)
  abort(&quot;The Rails environment is running in production mode!&quot;) if Rails.env.production?
  require 'rspec/rails'
  
  ActiveRecord::Migration.maintain_test_schema!
  
  
  module DeviseRequestSpecHelpers
  
    include Warden::Test::Helpers
  
    def sign_in(resource_or_scope, resource = nil)
      resource ||= resource_or_scope
      scope = Devise::Mapping.find_scope!(resource_or_scope)
      login_as(resource, scope: scope)
    end
  
    def sign_out(resource_or_scope)
      scope = Devise::Mapping.find_scope!(resource_or_scope)
      logout(scope)
    end
  
  end
  
  RSpec.configure do |config|
    Capybara.ignore_hidden_elements = false
  
    config.fixture_path = &quot;#{::Rails.root}/spec/fixtures&quot;
  
    config.use_transactional_fixtures = true
  
    config.infer_spec_type_from_file_location!
  
    config.filter_rails_from_backtrace!
    config.include Devise::Test::ControllerHelpers, type: :controller
    config.include DeviseRequestSpecHelpers, type: :request
  end
  
  Shoulda::Matchers.configure do |config|
    config.integrate do |with|
      with.test_framework :rspec
  
      with.library :rails
    end
  end
  </code></pre>
  <p>My <strong>spec_helper.rb</strong></p>
  <pre><code>RSpec.configure do |config|
    config.expect_with :rspec do |expectations|
      expectations.include_chain_clauses_in_custom_matcher_descriptions = true
    end
  
    config.mock_with :rspec do |mocks|
      mocks.verify_partial_doubles = true
    end
  
    config.shared_context_metadata_behavior = :apply_to_host_groups
  end
  </code></pre>
  <p>My <strong>view template</strong> for this images upload page:</p>
  <pre><code>.row.main-new-image
    = form_for @image, url: create_image_path, html: {multipart: true, method: :post, remote: true } do |form|
      #new_image_error_explanation
      .field
        .p.text-center
          %span.btn.btn-new-image{id: 'new-image-button'}
            %p#p-new-image-button Choose image
            \#{form.file_field :image, id: 'new-image-id'}
      .field
        = form.hidden_field :user_id, value: current_user.id
      .actions
        .p.text-center
          = form.submit 'Upload', class: 'btn button-upload-img', id: 'btn-upload-img'
  </code></pre>
  <p>All my other Capybara and RSpec tests works fine.</p>
  <p><strong>Please help me to understand what is the reason of this issue and how to solve it and prevent in the future.</strong></p>
  <p><em>I can provide more information if it can help to solve this issue.</em></p>
  <blockquote>
  <p><strong>UPDATE 1</strong></p>
  </blockquote>
  <p>After I read comment of Thomas Walpole I decide to update my code and try some other features.
  I include new gem</p>
  <blockquote>
  <p>gem 'database_cleaner'</p>
  </blockquote>
  <p>Also I have added new code to clear test uploaded code.
  Here is updated <strong>rails_helper.rb</strong></p>
  <pre><code>require 'support/factory_bot'
  require 'spec_helper'
  require 'shoulda/matchers'
  require 'capybara/rspec'
  ENV['RAILS_ENV'] ||= 'test'
  require File.expand_path('../../config/environment', __FILE__)
  Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
  abort(&quot;The Rails environment is running in production mode!&quot;) if Rails.env.production?
  require 'rspec/rails'
  
  ActiveRecord::Migration.maintain_test_schema!
  module DeviseRequestSpecHelpers
  
    include Warden::Test::Helpers
  
    def sign_in(resource_or_scope, resource = nil)
      resource ||= resource_or_scope
      scope = Devise::Mapping.find_scope!(resource_or_scope)
      login_as(resource, scope: scope)
    end
  
    def sign_out(resource_or_scope)
      scope = Devise::Mapping.find_scope!(resource_or_scope)
      logout(scope)
    end
  end
  
  RSpec.configure do |config|
    Capybara.javascript_driver = :selenium
    Capybara.ignore_hidden_elements = true
    Capybara.register_driver :selenium do |app|
      Capybara::Selenium::Driver.new(app, browser: :firefox)
    end
  
    config.include Capybara::DSL
    config.fixture_path = &quot;#{::Rails.root}/spec/fixtures&quot;
    config.use_transactional_fixtures = true
    config.before(:suite) do
      DatabaseCleaner.strategy = :transaction
      DatabaseCleaner.clean_with(:truncation)
    end
    
    config.around(:each) do |example|
      DatabaseCleaner.cleaning do
        example.run
      end
    end
    
    config.after(:all) do
      if Rails.env.test?
        FileUtils.rm_rf(Dir[&quot;#{Rails.root}/spec/support/uploads&quot;])
      end
    end
    config.infer_spec_type_from_file_location!
    config.filter_rails_from_backtrace!
    config.include Devise::Test::ControllerHelpers, type: :controller
    config.include DeviseRequestSpecHelpers, type: :request
  end
  
  Shoulda::Matchers.configure do |config|
    config.integrate do |with|
      with.test_framework :rspec
  
      with.library :rails
    end
  end
  </code></pre>
  <p>Here is my updated test</p>
  <pre><code>require 'rails_helper'
  
  describe 'Images', type: :feature do
    before(:each) do
      @user = create(:user)
      visit '/users/sign_in'
      fill_in 'sing-in-email-input', with: @user.email
      fill_in 'sign-in-password-input', with: @user.password
      click_button 'btn-sign-in'
      visit '/categories'
      click_on 'btn-new-category'
      have_current_path(new_category_path)
      fill_in 'category_name', with: 'Test'
      click_button 'btn-create category'
      visit '/categories'
      first('.fa', :visible =&gt; false).click
      have_current_path(category_path(id: Category.last.slug.to_s))
    end
  
    #ISSUE WITH
    it 'should allow a registered user to create image and go to it page', :driver =&gt; :selenium do
      click_on 'btn-upload-images'
      have_current_path(new_image_path(id: Category.last.slug.to_s))
      attach_file('image[image]',
                  File.join(Rails.root, '/spec/fixtures/solnce-kosmos-merkuriy.jpg'), :visible =&gt; false)
      click_on('btn-upload-img')
    end
  end
  </code></pre>
  <p>As Thomas Walpole told me, I checked test logs and saw next (about current test):</p>
  <pre><code>Started GET &quot;/en/categories/test/new_image&quot; for 127.0.0.1 at 2018-01-30 14:33:26 +0200
  Processing by ImagesController#new as HTML
    Parameters: {&quot;locale&quot;=&gt;&quot;en&quot;, &quot;id&quot;=&gt;&quot;test&quot;}
    User Load (0.2ms)  SELECT  &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = $1 ORDER BY &quot;users&quot;.&quot;id&quot; ASC LIMIT $2  [[&quot;id&quot;, 22], [&quot;LIMIT&quot;, 1]]
     (0.2ms)  SAVEPOINT active_record_2
    User Load (0.2ms)  SELECT  &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = $1 LIMIT $2  [[&quot;id&quot;, 22], [&quot;LIMIT&quot;, 1]]
    SQL (0.3ms)  INSERT INTO &quot;user_actions&quot; (&quot;user_id&quot;, &quot;action_type&quot;, &quot;url&quot;, &quot;created_at&quot;, &quot;updated_at&quot;) VALUES ($1, $2, $3, $4, $5) RETURNING &quot;id&quot;  [[&quot;user_id&quot;, 22], [&quot;action_type&quot;, &quot;navigation&quot;], [&quot;url&quot;, &quot;http://127.0.0.1:38226/en/categories/test/new_image&quot;], [&quot;created_at&quot;, &quot;2018-01-30 12:33:26.645909&quot;], [&quot;updated_at&quot;, &quot;2018-01-30 12:33:26.645909&quot;]]
     (0.1ms)  RELEASE SAVEPOINT active_record_2
    Rendering images/new.html.haml within layouts/application
    Rendered images/_form.html.haml (5.2ms)
    Rendered images/new.html.haml within layouts/application (7.5ms)
    Category Load (1.1ms)  SELECT  DISTINCT categories.*, COUNT(images.*) AS images_count, categories.*, COUNT(likes.*) AS likes_count, categories.*, COUNT(comments.*) AS comments_count FROM &quot;categories&quot; LEFT OUTER JOIN &quot;images&quot; ON &quot;images&quot;.&quot;category_id&quot; = &quot;categories&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;images&quot; &quot;images_categories_join&quot; ON &quot;images_categories_join&quot;.&quot;category_id&quot; = &quot;categories&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;likes&quot; ON &quot;likes&quot;.&quot;image_id&quot; = &quot;images_categories_join&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;images&quot; &quot;images_categories_join_2&quot; ON &quot;images_categories_join_2&quot;.&quot;category_id&quot; = &quot;categories&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;comments&quot; ON &quot;comments&quot;.&quot;image_id&quot; = &quot;images_categories_join_2&quot;.&quot;id&quot; GROUP BY categories.id ORDER BY images_count DESC, likes_count DESC, comments_count DESC LIMIT $1  [[&quot;LIMIT&quot;, 5]]
    Rendered layouts/_header.html.haml (4.3ms)
    Rendered layouts/_footer.haml (0.0ms)
  Completed 200 OK in 21ms (Views: 12.6ms | ActiveRecord: 2.1ms)
    Category Load (0.6ms)  SELECT  &quot;categories&quot;.* FROM &quot;categories&quot; ORDER BY &quot;categories&quot;.&quot;id&quot; DESC LIMIT $1  [[&quot;LIMIT&quot;, 1]]
  Started POST &quot;/en/categories/test/create_image&quot; for 127.0.0.1 at 2018-01-30 14:33:26 +0200
  Processing by ImagesController#create as JS
    Parameters: {&quot;utf8&quot;=&gt;&quot;✓&quot;, &quot;image&quot;=&gt;{&quot;image&quot;=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x0000000ae4e008 @tempfile=#&lt;Tempfile:/tmp/RackMultipart20180130-28977-1nptliu.jpg&gt;, @original_filename=&quot;solnce-kosmos-merkuriy.jpg&quot;, @content_type=&quot;image/jpeg&quot;, @headers=&quot;Content-Disposition: form-data; name=\&quot;image[image]\&quot;; filename=\&quot;solnce-kosmos-merkuriy.jpg\&quot;\r\nContent-Type: image/jpeg\r\n&quot;&gt;, &quot;user_id&quot;=&gt;&quot;22&quot;}, &quot;commit&quot;=&gt;&quot;Upload&quot;, &quot;locale&quot;=&gt;&quot;en&quot;, &quot;id&quot;=&gt;&quot;test&quot;}
    Category Load (0.2ms)  SELECT  &quot;categories&quot;.* FROM &quot;categories&quot; WHERE &quot;categories&quot;.&quot;slug&quot; = $1 LIMIT $2  [[&quot;slug&quot;, &quot;test&quot;], [&quot;LIMIT&quot;, 1]]
    User Load (0.1ms)  SELECT  &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = $1 ORDER BY &quot;users&quot;.&quot;id&quot; ASC LIMIT $2  [[&quot;id&quot;, 22], [&quot;LIMIT&quot;, 1]]
     (0.3ms)  SAVEPOINT active_record_2
    User Load (0.3ms)  SELECT  &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = $1 LIMIT $2  [[&quot;id&quot;, 22], [&quot;LIMIT&quot;, 1]]
    Category Load (0.2ms)  SELECT  &quot;categories&quot;.* FROM &quot;categories&quot; WHERE &quot;categories&quot;.&quot;id&quot; = $1 LIMIT $2  [[&quot;id&quot;, 18], [&quot;LIMIT&quot;, 1]]
    SQL (0.4ms)  INSERT INTO &quot;images&quot; (&quot;image&quot;, &quot;category_id&quot;, &quot;created_at&quot;, &quot;updated_at&quot;, &quot;user_id&quot;) VALUES ($1, $2, $3, $4, $5) RETURNING &quot;id&quot;  [[&quot;image&quot;, &quot;solnce-kosmos-merkuriy.jpg&quot;], [&quot;category_id&quot;, 18], [&quot;created_at&quot;, &quot;2018-01-30 12:33:26.945577&quot;], [&quot;updated_at&quot;, &quot;2018-01-30 12:33:26.945577&quot;], [&quot;user_id&quot;, 22]]
     (0.2ms)  RELEASE SAVEPOINT active_record_2
  Redirected to http://127.0.0.1:38226/en/categories/test/12
  Completed 200 OK in 22ms (ActiveRecord: 1.6ms)
  Started GET &quot;/en/categories/test/12&quot; for 127.0.0.1 at 2018-01-30 14:33:26 +0200
  Processing by ImagesController#show as HTML
    Parameters: {&quot;locale&quot;=&gt;&quot;en&quot;, &quot;id&quot;=&gt;&quot;test&quot;, &quot;image_id&quot;=&gt;&quot;12&quot;}
    User Load (0.6ms)  SELECT  &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = $1 ORDER BY &quot;users&quot;.&quot;id&quot; ASC LIMIT $2  [[&quot;id&quot;, 22], [&quot;LIMIT&quot;, 1]]
     (0.1ms)  SAVEPOINT active_record_2
    User Load (0.2ms)  SELECT  &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = $1 LIMIT $2  [[&quot;id&quot;, 22], [&quot;LIMIT&quot;, 1]]
    SQL (0.3ms)  INSERT INTO &quot;user_actions&quot; (&quot;user_id&quot;, &quot;action_type&quot;, &quot;url&quot;, &quot;created_at&quot;, &quot;updated_at&quot;) VALUES ($1, $2, $3, $4, $5) RETURNING &quot;id&quot;  [[&quot;user_id&quot;, 22], [&quot;action_type&quot;, &quot;navigation&quot;], [&quot;url&quot;, &quot;http://127.0.0.1:38226/en/categories/test/12&quot;], [&quot;created_at&quot;, &quot;2018-01-30 12:33:26.966397&quot;], [&quot;updated_at&quot;, &quot;2018-01-30 12:33:26.966397&quot;]]
     (0.1ms)  RELEASE SAVEPOINT active_record_2
    Category Load (0.1ms)  SELECT  &quot;categories&quot;.* FROM &quot;categories&quot; WHERE &quot;categories&quot;.&quot;slug&quot; = $1 LIMIT $2  [[&quot;slug&quot;, &quot;test&quot;], [&quot;LIMIT&quot;, 1]]
    Image Load (0.2ms)  SELECT  &quot;images&quot;.* FROM &quot;images&quot; WHERE &quot;images&quot;.&quot;category_id&quot; = $1 AND &quot;images&quot;.&quot;id&quot; = $2 LIMIT $3  [[&quot;category_id&quot;, 18], [&quot;id&quot;, 12], [&quot;LIMIT&quot;, 1]]
    Like Load (0.2ms)  SELECT  &quot;likes&quot;.* FROM &quot;likes&quot; WHERE &quot;likes&quot;.&quot;image_id&quot; = $1 AND &quot;likes&quot;.&quot;user_id&quot; = $2 LIMIT $3  [[&quot;image_id&quot;, 12], [&quot;user_id&quot;, 22], [&quot;LIMIT&quot;, 1]]
    Rendering images/show.html.haml within layouts/application
    User Load (0.2ms)  SELECT  &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = $1 LIMIT $2  [[&quot;id&quot;, 22], [&quot;LIMIT&quot;, 1]]
     (0.3ms)  SELECT COUNT(*) FROM &quot;comments&quot; WHERE &quot;comments&quot;.&quot;image_id&quot; = $1  [[&quot;image_id&quot;, 12]]
    Like Load (0.2ms)  SELECT  &quot;likes&quot;.* FROM &quot;likes&quot; WHERE &quot;likes&quot;.&quot;user_id&quot; = $1 AND &quot;likes&quot;.&quot;image_id&quot; = 12 LIMIT $2  [[&quot;user_id&quot;, 22], [&quot;LIMIT&quot;, 1]]
     (0.3ms)  SELECT COUNT(*) FROM &quot;likes&quot; WHERE &quot;likes&quot;.&quot;image_id&quot; = $1  [[&quot;image_id&quot;, 12]]
    Rendered likes/_like.html.haml (3.2ms)
    Rendered likes/_like_form.html.haml (7.3ms)
    Rendered comments/_comments.html.haml (2.7ms)
    Rendered comments/_comments_container.html.haml (5.1ms)
    Rendered images/show.html.haml within layouts/application (25.6ms)
    Category Load (1.3ms)  SELECT  DISTINCT categories.*, COUNT(images.*) AS images_count, categories.*, COUNT(likes.*) AS likes_count, categories.*, COUNT(comments.*) AS comments_count FROM &quot;categories&quot; LEFT OUTER JOIN &quot;images&quot; ON &quot;images&quot;.&quot;category_id&quot; = &quot;categories&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;images&quot; &quot;images_categories_join&quot; ON &quot;images_categories_join&quot;.&quot;category_id&quot; = &quot;categories&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;likes&quot; ON &quot;likes&quot;.&quot;image_id&quot; = &quot;images_categories_join&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;images&quot; &quot;images_categories_join_2&quot; ON &quot;images_categories_join_2&quot;.&quot;category_id&quot; = &quot;categories&quot;.&quot;id&quot; LEFT OUTER JOIN &quot;comments&quot; ON &quot;comments&quot;.&quot;image_id&quot; = &quot;images_categories_join_2&quot;.&quot;id&quot; GROUP BY categories.id ORDER BY images_count DESC, likes_count DESC, comments_count DESC LIMIT $1  [[&quot;LIMIT&quot;, 5]]
    Rendered layouts/_header.html.haml (4.6ms)
    Rendered layouts/_footer.haml (0.1ms)
  Completed 200 OK in 43ms (Views: 30.0ms | ActiveRecord: 4.1ms)
  Started GET &quot;/home/Anton-S/RubymineProjects/rails_projects/gallery/spec/support/uploads/image/image/12/solnce-kosmos-merkuriy.jpg&quot; for 127.0.0.1 at 2018-01-30 14:33:27 +0200
     (0.2ms)  ROLLBACK TO SAVEPOINT active_record_1
     (0.1ms)  ROLLBACK
     (0.1ms)  BEGIN
     (0.1ms)  COMMIT
     (0.0ms)  BEGIN
     (0.0ms)  SAVEPOINT active_record_1
     (0.1ms)  SAVEPOINT active_record_2
  </code></pre>
  <p>As I understand, image was successfully uploaded.
  But I still get this error</p>
  <pre><code>Failure/Error: raise ActionController::RoutingError, &quot;No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}&quot;
       
       ActionController::RoutingError:
         No route matches [GET] &quot;/home/Anton-S/RubymineProjects/rails_projects/gallery/spec/support/uploads/image/image/12/solnce-kosmos-merkuriy.jpg&quot;
  </code></pre>
  <blockquote>
  <p><strong>UPDATE 2</strong></p>
  </blockquote>
  <p>Unfortunately the only solution I found is to set in
  <strong>/config/environments/test.rb</strong></p>
  <pre><code>config.action_dispatch.show_exceptions = true
  </code></pre>
  <p>But I still think that there is better solution.</p>