1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test/application/rendering_test.rb

47 lines
981 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "isolation/abstract_unit"
require "rack/test"
2013-04-10 03:07:31 -04:00
module ApplicationTests
class RenderingTest < ActiveSupport::TestCase
2013-04-10 03:07:31 -04:00
include ActiveSupport::Testing::Isolation
include Rack::Test::Methods
def setup
build_app
end
def teardown
teardown_app
end
test "Unknown format falls back to HTML template" do
app_file "config/routes.rb", <<-RUBY
Rails.application.routes.draw do
2013-04-10 03:07:31 -04:00
get 'pages/:id', to: 'pages#show'
end
RUBY
app_file "app/controllers/pages_controller.rb", <<-RUBY
2013-04-10 03:07:31 -04:00
class PagesController < ApplicationController
layout false
def show
end
end
RUBY
app_file "app/views/pages/show.html.erb", <<-RUBY
2013-04-10 03:07:31 -04:00
<%= params[:id] %>
RUBY
get "/pages/foo"
2013-04-10 03:07:31 -04:00
assert_equal 200, last_response.status
get "/pages/foo.bar"
2013-04-10 03:07:31 -04:00
assert_equal 200, last_response.status
end
end
end