forked from hotwired/turbo-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create executable bug report Rails application
This template draws inspiration from Rails' [bug report templates][]. [bug report templates]: https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#create-an-executable-test-case
- Loading branch information
1 parent
e8dd34a
commit d2dbae8
Showing
3 changed files
with
106 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
require "bundler/inline" | ||
|
||
gemfile(true) do | ||
source "https://rubygems.org" | ||
|
||
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | ||
|
||
gem "rails" | ||
gem "propshaft" | ||
gem "sqlite3" | ||
gem "turbo-rails" | ||
|
||
gem "capybara" | ||
gem "cuprite", "~> 0.9", require: "capybara/cuprite" | ||
end | ||
|
||
require "active_record/railtie" | ||
# require "active_storage/engine" | ||
require "action_controller/railtie" | ||
require "action_view/railtie" | ||
# require "action_mailer/railtie" | ||
# require "active_job/railtie" | ||
# require "action_cable/engine" | ||
# require "action_mailbox/engine" | ||
# require "action_text/engine" | ||
require "rails/test_unit/railtie" | ||
|
||
class App < Rails::Application | ||
config.load_defaults Rails::VERSION::STRING.to_f | ||
|
||
config.root = __dir__ | ||
config.hosts << "example.org" | ||
config.eager_load = false | ||
config.session_store :cookie_store, key: "cookie_store_key" | ||
config.secret_key_base = "secret_key_base" | ||
config.turbo.draw_routes = false | ||
|
||
Rails.logger = config.logger = Logger.new($stdout) | ||
|
||
routes.append do | ||
root to: "application#index" | ||
end | ||
end | ||
|
||
class ApplicationController < ActionController::Base | ||
def index | ||
render inline: DATA.read | ||
end | ||
end | ||
|
||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | ||
driven_by :cuprite, using: :chrome, screen_size: [1400, 1400], options: { js_errors: true } | ||
|
||
Capybara.server = :webrick | ||
end | ||
|
||
ENV["DATABASE_URL"] = "sqlite3::memory:" | ||
ENV["RAILS_ENV"] ||= "test" | ||
|
||
Rails.application.initialize! | ||
|
||
require "rails/test_help" | ||
|
||
class TurboSystemTest < ApplicationSystemTestCase | ||
test "reproduces bug" do | ||
visit root_path | ||
|
||
assert_text "Loaded with Turbo" | ||
end | ||
end | ||
|
||
__END__ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<%= csrf_meta_tags %> | ||
|
||
<script type="importmap"> | ||
{ | ||
"imports": { | ||
"@hotwired/turbo-rails": "<%= asset_path("turbo.js") %>" | ||
} | ||
} | ||
</script> | ||
|
||
<script type="module"> | ||
import "@hotwired/turbo-rails" | ||
|
||
addEventListener("turbo:load", () => document.body.innerHTML = "Loaded with Turbo") | ||
</script> | ||
</head> | ||
|
||
<body>Loaded without Turbo</body> | ||
</html> |