1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/test/controller/new_base/render_file_test.rb

32 lines
708 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "abstract_unit"
2009-05-13 20:00:36 -04:00
module RenderFile
class BasicController < ActionController::Base
self.view_paths = __dir__
2009-05-13 20:00:36 -04:00
def index
render file: File.expand_path("../../fixtures/test/hello_world.erb", __dir__)
2009-05-13 20:00:36 -04:00
end
2009-05-13 20:00:36 -04:00
def pathname
render file: Pathname.new(__dir__).join(*%w[.. .. fixtures test dot.directory render_file_with_ivar.erb])
2009-05-13 20:00:36 -04:00
end
end
class TestBasic < Rack::TestCase
2009-05-13 20:00:36 -04:00
testing RenderFile::BasicController
test "rendering simple file" do
get :index
2009-05-13 20:00:36 -04:00
assert_response "Hello world!"
end
2009-05-13 20:00:36 -04:00
test "rendering a Pathname" do
get :pathname
assert_response "The secret is <%= @secret %>\n"
2009-05-13 20:00:36 -04:00
end
end
end