Home > other >  Minitest hanging on stylesheet_link_tag
Minitest hanging on stylesheet_link_tag

Time:11-22

An error in Minitest is generated for four actions (index, show, new, edit)

ActionView::Template::Error: Error: @supports condition expected declaration
    on line 9749:12 of stdin
>> @supports (scroll-snap-type) {
-----------^
app/views/layouts/application.html.erb:9

The line of the application layout invokes

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>

The controller test suite has 13 runs. 9 pass, but they all deal with non-view methods (update, create, destroy).

Under no circumstance of having stylesheet_link_tag active, plus or minus its options, does the test pass. The moment it is set to <%# the test runs (and passes)

The oddity is that these tests passed in the past and the application.html.erb was not modified. Turbolinks cannot be removed (and would seem odd to have a test suite fail for that).

The only change has been the introduction of coverage and rubycritic gems. Yet calling the tests in two different ways

rails test test/controllers/channels_controller_test.rb
COVERAGE=TRUE rails test test/controllers/channels_controller_test.rb

leads to the same result.
The test helper gets the first two lines toggled as well to test without coverage

require 'simplecov'
SimpleCov.start 'rails'

# Previous content of test helper now starts here

ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment"
require "rails/test_help"
require 'webmock/minitest'


class ActiveSupport::TestCase

  fixtures :all

  def log_in_as(user, shop)
    post user_session_url, params: { user_id: user.id, active_shop_id: @site.shop_id }
  end

end

Removing the gems

# gem 'rubycritic', '~> 4.6', '>= 4.6.1', require: false

group :test do
#  gem 'simplecov', '~> 0.21.2'
end

also generates the same result.

What should be configured so that minitest knows how to handle turbolinks?

CodePudding user response:

The key to resolving this was in a component of the error message

 on line 9749:12 

then it could only have come from a css file. examining the resulting application.css file allowed to go to that line immediately.

  • Related