Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47347 from jhawthorn/view_cache_main_reloader
Use "main" reloader and cache resolvers from {append,prepend}_view_path
- Loading branch information
Showing
10 changed files
with
189 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# frozen_string_literal: true | ||
|
||
require "isolation/abstract_unit" | ||
require "rack/test" | ||
|
||
module ApplicationTests | ||
class ViewReloadingTest < ActiveSupport::TestCase | ||
include ActiveSupport::Testing::Isolation | ||
include Rack::Test::Methods | ||
|
||
def setup | ||
build_app | ||
|
||
app_file "config/routes.rb", <<-RUBY | ||
Rails.application.routes.draw do | ||
get 'pages/:id', to: 'pages#show' | ||
end | ||
RUBY | ||
|
||
app_file "app/controllers/pages_controller.rb", <<-RUBY | ||
class PagesController < ApplicationController | ||
layout false | ||
def show | ||
end | ||
end | ||
RUBY | ||
end | ||
|
||
def teardown | ||
teardown_app | ||
end | ||
|
||
test "views are reloaded" do | ||
app_file "app/views/pages/show.html.erb", <<-RUBY | ||
Before! | ||
RUBY | ||
|
||
ENV["RAILS_ENV"] = "development" | ||
require "#{app_path}/config/environment" | ||
|
||
get "/pages/foo" | ||
get "/pages/foo" | ||
assert_equal 200, last_response.status, last_response.body | ||
assert_equal "Before!", last_response.body.strip | ||
|
||
app_file "app/views/pages/show.html.erb", <<-RUBY | ||
After! | ||
RUBY | ||
|
||
get "/pages/foo" | ||
assert_equal 200, last_response.status | ||
assert_equal "After!", last_response.body.strip | ||
end | ||
end | ||
end |