ruby on rails - ActionView::MissingTemplate errors on Travis CI (but not locally) -
solution
this silly one. git behaves strangely folders sometimes; changing folder name isn't change gets pushed. on github, view folder "bills" capital b, though "bills" locally.
i solved renaming old folder, creating new "bills" folder, , moving contents old folder new folder (since moving files pushable change). see this more details.
tl;dr
my tests pass locally , app seems work, of tests on 1 controller failing actionview::missingtemplate errors, despite fact templates appear in right place. idea why?
problem
i spent afternoon refactoring rails app (most notably, renaming legislation bill), i'm having build issue haven't been able figure out.
when run tests locally, pass, , clicking around app works expected. however, on travis ci, error (actionview::missingtemplate) in bills_controller_test.rb:
error: billscontrollertest#test_: bills should index. : actionview::missingtemplate: missing template bills/index, application/index {: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>' however, files app/views/bills/*.html.erb each controller action appear there. why can't travis find them? (again, tests in bills_controller_test.rb ones failing on travis , passing locally.)
i can't replicate locally, , googling , fiddling has been unsuccessful far.
what i've tried
- i've double-checked references bill have correct pluralization , capitalization (they appear to)–this first guess because os x , linux treat capitalization differently.
- i've checked other edits, particularly configuration changes .travis.yml , test_helper.rb, neither appear have caused problem.
- i've confirmed bills_controller_test.rb connecting app/controllers/bills_controller.rb, , (the error arrises on
render: :<action>@ end of controller action)
relevant code snippets
test/controllers/bills_controller_test.rb (#index) (on github)
require 'test_helper' class billscontrollertest < actioncontroller::testcase context 'bills' should 'get index' :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] # /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 namespace :api, defaults: { format: 'json' } scope module: :v1, constraints: apiversion.new('v1', true) resources :bills, only: [:index, :show] resources :meetings, only: [:index, :show] scope '/meetings/:id' '/agenda', to: 'meetings#agenda', as: 'agenda' '/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' '/agenda', to: 'meetings#agenda', as: 'agenda' '/minutes', to: 'meetings#minutes', as: 'minutes' '/in_progress', to: 'meetings#start_meeting', as: 'start_meeting' '/agenda/toggle', to: 'meetings#toggle_agenda', as: 'toggle_agenda' '/minutes/toggle', to: 'meetings#toggle_minutes', as: 'toggle_minutes' end 'search', to: 'search#index', as: 'search' post 'versions/:id/revert', to: 'versions#revert', as: 'revert_version' root 'meetings#index' end ideas
- could have sort of cacheing issue travis since changed legislation bill?
- could namespace issue between api , default namespaces (i don't think because bills problem)
- is there typo missed?
i figured out right after posted. why couldn't have happened several hours ago? :( i'll leave question in case others have same issue.
git doesn't track folders tracks files. checked repository on github, , views under /app/views/bills there; guess when changed during refactoring, didn't pushed because it's folder.
i fixed renaming local file bills , them moving contents bills (old folder) bills (a new folder). (more detail)
Comments
Post a Comment