ActionView :: MissingTemplate errors in Travis CI (but not locally)

Decision

This is stupid. Git behaves strangely with folders; changing the folder name is not the change that is clicked. On GitHub, my browse folder was "Accounts" with capital B, even though these were "accounts" locally.

I solved this by renaming my old folder, creating a new "accounts" folder, and then moving the content from the old folder to the new folder (since moving files is mutable). See this for details .

TL; DR

My tests are running locally and the application seems to be working, but all of my tests on the same controller fail with ActionView :: MissingTemplate errors, despite the templates appearing in the right place. Any idea why?

Problem

I just did a rails to rails refinance (specifically renaming the Bill Legislation), but now I have an assembly issue that I could not figure out.

When I run my tests locally, they all pass and clicking on it works as expected. However, on Travis CI, I get this error (ActionView :: MissingTemplate) for everything in my bills_controller_test.rb:

Error:
BillsControllerTest#test_: bills should get index. :
ActionView::MissingTemplate: Missing template bills/index, application/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :prawn, :coffee, :jbuilder]}. Searched in:
  * "/home/travis/build/troy-open-data/legislative_twitter/app/views"
  * "/home/travis/build/troy-open-data/legislative_twitter/vendor/bundle/ruby/2.2.0/gems/kaminari-0.16.3/app/views"
  * "/home/travis/build/troy-open-data/legislative_twitter/vendor/bundle/ruby/2.2.0/gems/foundation-rails-5.5.1.0/app/views"
    test/controllers/bills_controller_test.rb:6:in `block (2 levels) in <class:BillsControllerTest>'

      

( On Travis )

However, files app/views/bills/*.html.erb

for each controller action seem to exist. Why isn't Travis finding them? (Again, the tests in bills_controller_test.rb are the only ones that fail on Travis, and they run locally.)

I cannot replicate this locally, and my Googling and driving with it has so far been unsuccessful.

What i tried

  • I double checked that all account references have the correct pluralization and capitalization (they seem to be). This was my first guess, because OS X and Linux sometimes handle capitalization differently.
  • I checked other changes, especially the configuration changes on .travis.yml and test_helper.rb, but it didn't seem to cause the problem.
  • I have confirmed that bills_controller_test.rb actually connects to app / controller / bills_controller.rb and this (the error occurs at render: :<action>

    the end of the controller action)

Relevant code snippets

test / controllers / bills_controller_test.rb (#index) ( on GitHub )

require 'test_helper'

class BillsControllerTest < ActionController::TestCase
  context 'bills' do
    should 'get index' do
      get :index
      assert_response :success
      assert_not_nil assigns(:bills)
    end
    ...
  end
  ...
end

      

app / controllers / bills_controller.rb (#index) ( on GitHub )

class BillsController < ApplicationController
  before_action :set_bill, only: [:show, :edit, :update, :destroy]

  # GET /bills
  def index
    @bills = Bill.by_recent
                 .includes(:attachments)
                 .page(params[:page])
  end
  ...
end

      

routes.rb ( on GitHub )

require 'api_version'  # lib/api_version.rb

Rails.application.routes.draw do
  namespace :api, defaults: { format: 'json' } do
    scope module: :v1, constraints: ApiVersion.new('v1', true) do
      resources :bills,         only: [:index, :show]
      resources :meetings,      only: [:index, :show]
      scope '/meetings/:id' do
        get '/agenda',  to: 'meetings#agenda',  as: 'agenda'
        get '/minutes', to: 'meetings#minutes', as: 'minutes'
      end
      resources :organizations, only: [:index, :show]
      root to: 'data#index'
    end
  end


  resources :bills
  resources :organizations
  resources :meetings
  scope '/meetings/:id' do
    get '/agenda',  to: 'meetings#agenda', as: 'agenda'
    get '/minutes', to: 'meetings#minutes', as: 'minutes'
    get '/in_progress',  to: 'meetings#start_meeting', as: 'start_meeting'
    get '/agenda/toggle',   to: 'meetings#toggle_agenda',  as: 'toggle_agenda'
    get '/minutes/toggle',  to: 'meetings#toggle_minutes', as: 'toggle_minutes'
  end
  get 'search', to: 'search#index', as: 'search'
  post 'versions/:id/revert', to: 'versions#revert', as: 'revert_version'

  root 'meetings#index'
end

      

Ideas

  • May I have some kind of caching issue with Travis since I just changed the legislation for Bill?
  • Could this be a namespace problem between my API and default namespaces (I don't think so because Bills is the only problem)
  • Is there a typo I missed?
+3


source to share


1 answer


I figured it out right after posting. Why couldn't this have happened a few hours ago? :( I'll leave this question in case others have the same problem.

Git does not keep track of folders such as track files. I checked out my repository on GitHub and the views are under / app / views / B .; I think when I changed it during refactoring it wasn't clicked because it is a folder.



I fixed it by renaming the local file to Bills and moving all content from Bills (old folder) to bills (new folder). ( more )

+3


source







All Articles