Skip to content

Commit 75a2f19

Browse files
author
David Heinemeier Hansson
committed
Basic test setup
1 parent 05e3110 commit 75a2f19

File tree

169 files changed

+1327
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+1327
-0
lines changed

Diff for: Gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ gem "rails", "~> #{rails_version}"
1010
gem "sqlite3"
1111

1212
group :test do
13+
gem "turbo-rails"
14+
gem "stimulus-rails"
15+
16+
gem "byebug"
17+
1318
gem "capybara"
1419
gem "selenium-webdriver"
1520
gem "webdrivers"

Diff for: Gemfile.lock

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
PATH
2+
remote: .
3+
specs:
4+
importmap-rails (0.1.0)
5+
rails (>= 6.0.0)
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
actioncable (6.1.3.1)
11+
actionpack (= 6.1.3.1)
12+
activesupport (= 6.1.3.1)
13+
nio4r (~> 2.0)
14+
websocket-driver (>= 0.6.1)
15+
actionmailbox (6.1.3.1)
16+
actionpack (= 6.1.3.1)
17+
activejob (= 6.1.3.1)
18+
activerecord (= 6.1.3.1)
19+
activestorage (= 6.1.3.1)
20+
activesupport (= 6.1.3.1)
21+
mail (>= 2.7.1)
22+
actionmailer (6.1.3.1)
23+
actionpack (= 6.1.3.1)
24+
actionview (= 6.1.3.1)
25+
activejob (= 6.1.3.1)
26+
activesupport (= 6.1.3.1)
27+
mail (~> 2.5, >= 2.5.4)
28+
rails-dom-testing (~> 2.0)
29+
actionpack (6.1.3.1)
30+
actionview (= 6.1.3.1)
31+
activesupport (= 6.1.3.1)
32+
rack (~> 2.0, >= 2.0.9)
33+
rack-test (>= 0.6.3)
34+
rails-dom-testing (~> 2.0)
35+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
36+
actiontext (6.1.3.1)
37+
actionpack (= 6.1.3.1)
38+
activerecord (= 6.1.3.1)
39+
activestorage (= 6.1.3.1)
40+
activesupport (= 6.1.3.1)
41+
nokogiri (>= 1.8.5)
42+
actionview (6.1.3.1)
43+
activesupport (= 6.1.3.1)
44+
builder (~> 3.1)
45+
erubi (~> 1.4)
46+
rails-dom-testing (~> 2.0)
47+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
48+
activejob (6.1.3.1)
49+
activesupport (= 6.1.3.1)
50+
globalid (>= 0.3.6)
51+
activemodel (6.1.3.1)
52+
activesupport (= 6.1.3.1)
53+
activerecord (6.1.3.1)
54+
activemodel (= 6.1.3.1)
55+
activesupport (= 6.1.3.1)
56+
activestorage (6.1.3.1)
57+
actionpack (= 6.1.3.1)
58+
activejob (= 6.1.3.1)
59+
activerecord (= 6.1.3.1)
60+
activesupport (= 6.1.3.1)
61+
marcel (~> 1.0.0)
62+
mini_mime (~> 1.0.2)
63+
activesupport (6.1.3.1)
64+
concurrent-ruby (~> 1.0, >= 1.0.2)
65+
i18n (>= 1.6, < 2)
66+
minitest (>= 5.1)
67+
tzinfo (~> 2.0)
68+
zeitwerk (~> 2.3)
69+
addressable (2.8.0)
70+
public_suffix (>= 2.0.2, < 5.0)
71+
builder (3.2.4)
72+
byebug (11.1.3)
73+
capybara (3.35.3)
74+
addressable
75+
mini_mime (>= 0.1.3)
76+
nokogiri (~> 1.8)
77+
rack (>= 1.6.0)
78+
rack-test (>= 0.6.3)
79+
regexp_parser (>= 1.5, < 3.0)
80+
xpath (~> 3.2)
81+
childprocess (3.0.0)
82+
concurrent-ruby (1.1.9)
83+
crass (1.0.6)
84+
erubi (1.10.0)
85+
globalid (0.5.1)
86+
activesupport (>= 5.0)
87+
i18n (1.8.10)
88+
concurrent-ruby (~> 1.0)
89+
loofah (2.10.0)
90+
crass (~> 1.0.2)
91+
nokogiri (>= 1.5.9)
92+
mail (2.7.1)
93+
mini_mime (>= 0.1.1)
94+
marcel (1.0.1)
95+
method_source (1.0.0)
96+
mini_mime (1.0.3)
97+
minitest (5.14.4)
98+
nio4r (2.5.7)
99+
nokogiri (1.11.7-x86_64-darwin)
100+
racc (~> 1.4)
101+
public_suffix (4.0.6)
102+
racc (1.5.2)
103+
rack (2.2.3)
104+
rack-test (1.1.0)
105+
rack (>= 1.0, < 3)
106+
rails (6.1.3.1)
107+
actioncable (= 6.1.3.1)
108+
actionmailbox (= 6.1.3.1)
109+
actionmailer (= 6.1.3.1)
110+
actionpack (= 6.1.3.1)
111+
actiontext (= 6.1.3.1)
112+
actionview (= 6.1.3.1)
113+
activejob (= 6.1.3.1)
114+
activemodel (= 6.1.3.1)
115+
activerecord (= 6.1.3.1)
116+
activestorage (= 6.1.3.1)
117+
activesupport (= 6.1.3.1)
118+
bundler (>= 1.15.0)
119+
railties (= 6.1.3.1)
120+
sprockets-rails (>= 2.0.0)
121+
rails-dom-testing (2.0.3)
122+
activesupport (>= 4.2.0)
123+
nokogiri (>= 1.6)
124+
rails-html-sanitizer (1.3.0)
125+
loofah (~> 2.3)
126+
railties (6.1.3.1)
127+
actionpack (= 6.1.3.1)
128+
activesupport (= 6.1.3.1)
129+
method_source
130+
rake (>= 0.8.7)
131+
thor (~> 1.0)
132+
rake (13.0.6)
133+
regexp_parser (2.1.1)
134+
rubyzip (2.3.2)
135+
selenium-webdriver (3.142.7)
136+
childprocess (>= 0.5, < 4.0)
137+
rubyzip (>= 1.2.2)
138+
sprockets (4.0.2)
139+
concurrent-ruby (~> 1.0)
140+
rack (> 1, < 3)
141+
sprockets-rails (3.2.2)
142+
actionpack (>= 4.0)
143+
activesupport (>= 4.0)
144+
sprockets (>= 3.0.0)
145+
sqlite3 (1.4.2)
146+
stimulus-rails (0.2.4)
147+
rails (>= 6.0.0)
148+
thor (1.1.0)
149+
turbo-rails (0.6.0)
150+
rails (>= 6.0.0)
151+
tzinfo (2.0.4)
152+
concurrent-ruby (~> 1.0)
153+
webdrivers (4.6.0)
154+
nokogiri (~> 1.6)
155+
rubyzip (>= 1.3.0)
156+
selenium-webdriver (>= 3.0, < 4.0)
157+
websocket-driver (0.7.5)
158+
websocket-extensions (>= 0.1.0)
159+
websocket-extensions (0.1.5)
160+
xpath (3.2.0)
161+
nokogiri (~> 1.8)
162+
zeitwerk (2.4.2)
163+
164+
PLATFORMS
165+
x86_64-darwin-20
166+
167+
DEPENDENCIES
168+
byebug
169+
capybara
170+
importmap-rails!
171+
rails (~> 6.1.0)
172+
selenium-webdriver
173+
sqlite3
174+
stimulus-rails
175+
turbo-rails
176+
webdrivers
177+
178+
BUNDLED WITH
179+
2.2.24

Diff for: Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
require "bundler/setup"
22

3+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4+
load "rails/tasks/engine.rake"
5+
6+
load "rails/tasks/statistics.rake"
7+
38
require "bundler/gem_tasks"
49

510
require "rake/testtask"
@@ -8,6 +13,7 @@ Rake::TestTask.new(:test) do |t|
813
t.libs << 'test'
914
t.pattern = 'test/**/*_test.rb'
1015
t.verbose = false
16+
t.warning = false
1117
end
1218

1319
task default: :test

Diff for: lib/shim.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "es-module-shim"

Diff for: test/dummy/Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative "config/application"
5+
6+
Rails.application.load_tasks

Diff for: test/dummy/app/assets/config/manifest.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//= link_tree ../images
2+
//= link_directory ../stylesheets .css
3+
//= link_tree ../javascripts

Diff for: test/dummy/app/assets/images/.keep

Whitespace-only changes.

Diff for: test/dummy/app/assets/javascripts/application.js

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Controller } from "stimulus"
2+
3+
export default class extends Controller {
4+
connect() {
5+
this.element.textContent = "Goodbye World"
6+
}
7+
}

Diff for: test/dummy/app/assets/stylesheets/application.css

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
9+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10+
* files in this directory. Styles in this file should be added after the last require_* statement.
11+
* It is generally better to create a new file per style scope.
12+
*
13+
*= require_tree .
14+
*= require_self
15+
*/

Diff for: test/dummy/app/channels/application_cable/channel.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Channel < ActionCable::Channel::Base
3+
end
4+
end
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Connection < ActionCable::Connection::Base
3+
end
4+
end

Diff for: test/dummy/app/controllers/application_controller.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationController < ActionController::Base
2+
end

Diff for: test/dummy/app/controllers/concerns/.keep

Whitespace-only changes.

Diff for: test/dummy/app/helpers/application_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module ApplicationHelper
2+
end

Diff for: test/dummy/app/javascript/packs/application.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is a manifest file that'll be compiled into application.js, which will include all the files
2+
// listed below.
3+
//
4+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6+
//
7+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
9+
//
10+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11+
// about supported directives.
12+
//
13+
//= require rails-ujs
14+
//= require activestorage
15+
//= require_tree .

Diff for: test/dummy/app/jobs/application_job.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class ApplicationJob < ActiveJob::Base
2+
# Automatically retry jobs that encountered a deadlock
3+
# retry_on ActiveRecord::Deadlocked
4+
5+
# Most jobs are safe to ignore if the underlying records are no longer available
6+
# discard_on ActiveJob::DeserializationError
7+
end

Diff for: test/dummy/app/models/application_record.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationRecord < ActiveRecord::Base
2+
self.abstract_class = true
3+
end

Diff for: test/dummy/app/models/concerns/.keep

Whitespace-only changes.

Diff for: test/dummy/app/views/layouts/application.html.erb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Dummy</title>
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<%= csrf_meta_tags %>
7+
<%= csp_meta_tag %>
8+
9+
<%= stylesheet_link_tag 'application', media: 'all' %>
10+
</head>
11+
12+
<body>
13+
<%= yield %>
14+
</body>
15+
</html>

Diff for: test/dummy/app/views/layouts/mailer.html.erb

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<style>
6+
/* Email styles need to be inline */
7+
</style>
8+
</head>
9+
10+
<body>
11+
<%= yield %>
12+
</body>
13+
</html>

Diff for: test/dummy/app/views/layouts/mailer.text.erb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= yield %>

Diff for: test/dummy/bin/rails

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env ruby
2+
APP_PATH = File.expand_path('../config/application', __dir__)
3+
require_relative "../config/boot"
4+
require "rails/commands"

Diff for: test/dummy/bin/rake

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env ruby
2+
require_relative "../config/boot"
3+
require "rake"
4+
Rake.application.run

Diff for: test/dummy/bin/setup

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env ruby
2+
require "fileutils"
3+
4+
# path to your application root.
5+
APP_ROOT = File.expand_path('..', __dir__)
6+
7+
def system!(*args)
8+
system(*args) || abort("\n== Command #{args} failed ==")
9+
end
10+
11+
FileUtils.chdir APP_ROOT do
12+
# This script is a way to set up or update your development environment automatically.
13+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
14+
# Add necessary setup steps to this file.
15+
16+
puts '== Installing dependencies =='
17+
system! 'gem install bundler --conservative'
18+
system('bundle check') || system!('bundle install')
19+
20+
# puts "\n== Copying sample files =="
21+
# unless File.exist?('config/database.yml')
22+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
23+
# end
24+
25+
puts "\n== Preparing database =="
26+
system! 'bin/rails db:prepare'
27+
28+
puts "\n== Removing old logs and tempfiles =="
29+
system! 'bin/rails log:clear tmp:clear'
30+
31+
puts "\n== Restarting application server =="
32+
system! 'bin/rails restart'
33+
end

Diff for: test/dummy/config.ru

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file is used by Rack-based servers to start the application.
2+
3+
require_relative "config/environment"
4+
5+
run Rails.application
6+
Rails.application.load_server

0 commit comments

Comments
 (0)