vite_rb 0.0.1.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +3 -0
  3. data/.dockerignore +22 -0
  4. data/.github/FUNDING.yml +1 -0
  5. data/.github/workflows/build.yml +17 -0
  6. data/.gitignore +71 -0
  7. data/.ruby-version +1 -0
  8. data/.solargraph.yml +16 -0
  9. data/.standard.yml +11 -0
  10. data/CHANGELOG.md +65 -0
  11. data/Gemfile +8 -0
  12. data/LICENSE.txt +21 -0
  13. data/README.md +258 -0
  14. data/Rakefile +39 -0
  15. data/bin/console +15 -0
  16. data/bin/setup +8 -0
  17. data/examples/rails-without-webpack/.gitignore +34 -0
  18. data/examples/rails-without-webpack/.ruby-version +1 -0
  19. data/examples/rails-without-webpack/Gemfile +33 -0
  20. data/examples/rails-without-webpack/README.md +24 -0
  21. data/examples/rails-without-webpack/Rakefile +6 -0
  22. data/examples/rails-without-webpack/app/assets/config/manifest.js +2 -0
  23. data/examples/rails-without-webpack/app/assets/images/.keep +0 -0
  24. data/examples/rails-without-webpack/app/assets/stylesheets/application.css +15 -0
  25. data/examples/rails-without-webpack/app/assets/stylesheets/static_pages.scss +3 -0
  26. data/examples/rails-without-webpack/app/channels/application_cable/channel.rb +4 -0
  27. data/examples/rails-without-webpack/app/channels/application_cable/connection.rb +4 -0
  28. data/examples/rails-without-webpack/app/channels/chat_channel.rb +12 -0
  29. data/examples/rails-without-webpack/app/controllers/application_controller.rb +2 -0
  30. data/examples/rails-without-webpack/app/controllers/concerns/.keep +0 -0
  31. data/examples/rails-without-webpack/app/controllers/static_pages_controller.rb +4 -0
  32. data/examples/rails-without-webpack/app/helpers/application_helper.rb +2 -0
  33. data/examples/rails-without-webpack/app/helpers/static_pages_helper.rb +2 -0
  34. data/examples/rails-without-webpack/app/jobs/application_job.rb +7 -0
  35. data/examples/rails-without-webpack/app/mailers/application_mailer.rb +4 -0
  36. data/examples/rails-without-webpack/app/models/application_record.rb +3 -0
  37. data/examples/rails-without-webpack/app/models/concerns/.keep +0 -0
  38. data/examples/rails-without-webpack/app/snowpacker/assets/fake-asset.png +0 -0
  39. data/examples/rails-without-webpack/app/snowpacker/channels/consumer.js +5 -0
  40. data/examples/rails-without-webpack/app/snowpacker/channels/index.js +2 -0
  41. data/examples/rails-without-webpack/app/snowpacker/entrypoints/application.js +10 -0
  42. data/examples/rails-without-webpack/app/snowpacker/javascript/index.js +1 -0
  43. data/examples/rails-without-webpack/app/snowpacker/stylesheets/index.css +3 -0
  44. data/examples/rails-without-webpack/app/views/layouts/application.html.erb +15 -0
  45. data/examples/rails-without-webpack/app/views/layouts/mailer.html.erb +13 -0
  46. data/examples/rails-without-webpack/app/views/layouts/mailer.text.erb +1 -0
  47. data/examples/rails-without-webpack/app/views/static_pages/index.html.erb +2 -0
  48. data/examples/rails-without-webpack/bin/bundle +114 -0
  49. data/examples/rails-without-webpack/bin/rails +9 -0
  50. data/examples/rails-without-webpack/bin/rake +9 -0
  51. data/examples/rails-without-webpack/bin/setup +36 -0
  52. data/examples/rails-without-webpack/bin/spring +17 -0
  53. data/examples/rails-without-webpack/bin/yarn +9 -0
  54. data/examples/rails-without-webpack/config.ru +5 -0
  55. data/examples/rails-without-webpack/config/application.rb +19 -0
  56. data/examples/rails-without-webpack/config/boot.rb +4 -0
  57. data/examples/rails-without-webpack/config/cable.yml +10 -0
  58. data/examples/rails-without-webpack/config/credentials.yml.enc +1 -0
  59. data/examples/rails-without-webpack/config/database.yml +25 -0
  60. data/examples/rails-without-webpack/config/environment.rb +5 -0
  61. data/examples/rails-without-webpack/config/environments/development.rb +62 -0
  62. data/examples/rails-without-webpack/config/environments/production.rb +112 -0
  63. data/examples/rails-without-webpack/config/environments/test.rb +49 -0
  64. data/examples/rails-without-webpack/config/initializers/application_controller_renderer.rb +8 -0
  65. data/examples/rails-without-webpack/config/initializers/assets.rb +14 -0
  66. data/examples/rails-without-webpack/config/initializers/backtrace_silencers.rb +7 -0
  67. data/examples/rails-without-webpack/config/initializers/content_security_policy.rb +31 -0
  68. data/examples/rails-without-webpack/config/initializers/cookies_serializer.rb +5 -0
  69. data/examples/rails-without-webpack/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/examples/rails-without-webpack/config/initializers/inflections.rb +16 -0
  71. data/examples/rails-without-webpack/config/initializers/mime_types.rb +4 -0
  72. data/examples/rails-without-webpack/config/initializers/snowpacker.rb +41 -0
  73. data/examples/rails-without-webpack/config/initializers/wrap_parameters.rb +14 -0
  74. data/examples/rails-without-webpack/config/locales/en.yml +33 -0
  75. data/examples/rails-without-webpack/config/puma.rb +38 -0
  76. data/examples/rails-without-webpack/config/routes.rb +5 -0
  77. data/examples/rails-without-webpack/config/snowpacker/.browserslistrc +1 -0
  78. data/examples/rails-without-webpack/config/snowpacker/babel.config.js +76 -0
  79. data/examples/rails-without-webpack/config/snowpacker/postcss.config.js +12 -0
  80. data/examples/rails-without-webpack/config/snowpacker/snowpack.config.js +61 -0
  81. data/examples/rails-without-webpack/config/spring.rb +6 -0
  82. data/examples/rails-without-webpack/config/storage.yml +34 -0
  83. data/examples/rails-without-webpack/db/seeds.rb +7 -0
  84. data/examples/rails-without-webpack/lib/assets/.keep +0 -0
  85. data/examples/rails-without-webpack/lib/tasks/.keep +0 -0
  86. data/examples/rails-without-webpack/package.json +20 -0
  87. data/examples/rails-without-webpack/storage/.keep +0 -0
  88. data/examples/rails-without-webpack/test/application_system_test_case.rb +5 -0
  89. data/examples/rails-without-webpack/test/channels/application_cable/connection_test.rb +11 -0
  90. data/examples/rails-without-webpack/test/channels/chat_channel_test.rb +8 -0
  91. data/examples/rails-without-webpack/test/controllers/.keep +0 -0
  92. data/examples/rails-without-webpack/test/controllers/static_pages_controller_test.rb +8 -0
  93. data/examples/rails-without-webpack/test/fixtures/.keep +0 -0
  94. data/examples/rails-without-webpack/test/fixtures/files/.keep +0 -0
  95. data/examples/rails-without-webpack/test/helpers/.keep +0 -0
  96. data/examples/rails-without-webpack/test/integration/.keep +0 -0
  97. data/examples/rails-without-webpack/test/mailers/.keep +0 -0
  98. data/examples/rails-without-webpack/test/models/.keep +0 -0
  99. data/examples/rails-without-webpack/test/system/.keep +0 -0
  100. data/examples/rails-without-webpack/test/test_helper.rb +13 -0
  101. data/examples/rails-without-webpack/vendor/.keep +0 -0
  102. data/examples/rails-without-webpack/yarn.lock +7545 -0
  103. data/lib/tasks/rails.rake +31 -0
  104. data/lib/tasks/ruby.rake +21 -0
  105. data/lib/vite_rb.rb +25 -0
  106. data/lib/vite_rb/configuration.rb +56 -0
  107. data/lib/vite_rb/engine.rb +5 -0
  108. data/lib/vite_rb/env.rb +29 -0
  109. data/lib/vite_rb/generator.rb +81 -0
  110. data/lib/vite_rb/helpers.rb +51 -0
  111. data/lib/vite_rb/manifest.rb +40 -0
  112. data/lib/vite_rb/proxy.rb +35 -0
  113. data/lib/vite_rb/runner.rb +46 -0
  114. data/lib/vite_rb/templates/postcss.config.js +12 -0
  115. data/lib/vite_rb/templates/vite.config.js +71 -0
  116. data/lib/vite_rb/templates/vite.rb.tt +54 -0
  117. data/lib/vite_rb/templates/vite/channels/consumer.js +5 -0
  118. data/lib/vite_rb/templates/vite/channels/index.js +2 -0
  119. data/lib/vite_rb/templates/vite/entrypoints/application.js +10 -0
  120. data/lib/vite_rb/templates/vite/stylesheets/index.css +3 -0
  121. data/lib/vite_rb/utils.rb +55 -0
  122. data/lib/vite_rb/version.rb +5 -0
  123. data/package.json +25 -0
  124. data/package/src/index.js +0 -0
  125. data/vite_rb.gemspec +46 -0
  126. data/yarn.lock +1215 -0
  127. metadata +337 -0
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Specify a serializer for the signed and encrypted cookie jars.
4
+ # Valid options are :json, :marshal, and :hybrid.
5
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,41 @@
1
+ Rails.application.config.middleware.insert_before 0, ViteRb
2
+
3
+ ViteRb.configure do |vite|
4
+ # Where to build snowpack to (out dir)
5
+ vite.build_dir = "public"
6
+
7
+ # url to use for assets IE: /vite/xyz.css, gets built to public/frontend
8
+ vite.output_dir = "vite"
9
+
10
+ # Where to find the config directory
11
+ vite.config_path = Rails.root.join("config", "vite")
12
+ vite.mount_path = Rails.root.join("app", "vite")
13
+ vite.manifest_file = Rails.root.join(vite.build_dir, vite.output_dir, "manifest.json")
14
+
15
+ # Where to find the snowpack config file
16
+ vite.config_file = File.join(vite.config_path, "vite.config.js")
17
+
18
+ # Where to find the postcss config file
19
+ vite.postcss_config_file = File.join(vite.config_path, "postcss.config.js")
20
+
21
+ # Where to find your snowpack files
22
+ vite.entrypoints_dir = "entrypoints"
23
+
24
+ # What port to run vite with
25
+ vite.port = "4035"
26
+
27
+ # What hostname to use
28
+ vite.hostname = "localhost"
29
+
30
+ # Whether or not to use https
31
+ # https://www.snowpack.dev/#https%2Fhttp2
32
+ vite.https = false
33
+ end
34
+
35
+ ActiveSupport.on_load :action_controller do
36
+ ActionController::Base.helper ViteRb
37
+ end
38
+
39
+ ActiveSupport.on_load :action_view do
40
+ include ViteRb
41
+ end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,33 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at https://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
@@ -0,0 +1,38 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9
+ threads min_threads_count, max_threads_count
10
+
11
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
12
+ #
13
+ port ENV.fetch("PORT") { 3000 }
14
+
15
+ # Specifies the `environment` that Puma will run in.
16
+ #
17
+ environment ENV.fetch("RAILS_ENV") { "development" }
18
+
19
+ # Specifies the `pidfile` that Puma will use.
20
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
21
+
22
+ # Specifies the number of `workers` to boot in clustered mode.
23
+ # Workers are forked web server processes. If using threads and workers together
24
+ # the concurrency of the application would be max `threads` * `workers`.
25
+ # Workers do not work on JRuby or Windows (both of which do not support
26
+ # processes).
27
+ #
28
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
29
+
30
+ # Use the `preload_app!` method when specifying a `workers` number.
31
+ # This directive tells Puma to first boot the application and load code
32
+ # before forking the application. This takes advantage of Copy On Write
33
+ # process behavior so workers use less memory.
34
+ #
35
+ # preload_app!
36
+
37
+ # Allow puma to be restarted by `rails restart` command.
38
+ plugin :tmp_restart
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ root "static_pages#index"
3
+
4
+ # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
5
+ end
@@ -0,0 +1,76 @@
1
+ module.exports = function(api) {
2
+ const validEnv = ['development', 'test', 'production']
3
+ const currentEnv = process.env.NODE_ENV
4
+ const isDevelopmentEnv = (currentEnv === "development")
5
+ const isProductionEnv = (currentEnv === 'production')
6
+ const isTestEnv = (currentEnv === 'test')
7
+
8
+ if (!validEnv.includes(currentEnv)) {
9
+ throw new Error(
10
+ 'Please specify a valid `NODE_ENV` or ' +
11
+ '`BABEL_ENV` environment variables. Valid values are "development", ' +
12
+ '"test", and "production". Instead, received: ' +
13
+ JSON.stringify(currentEnv) +
14
+ '.'
15
+ )
16
+ }
17
+
18
+ // Cached based on the value of some function. If this function returns a value different from
19
+ // a previously-encountered value, the plugins will re-evaluate.
20
+ api.cache(() => currentEnv);
21
+
22
+ return {
23
+ presets: [
24
+ isTestEnv && [
25
+ '@babel/preset-env',
26
+ {
27
+ targets: {
28
+ node: 'current'
29
+ }
30
+ }
31
+ ],
32
+ (isProductionEnv || isDevelopmentEnv) && [
33
+ '@babel/preset-env',
34
+ {
35
+ forceAllTransforms: true,
36
+ useBuiltIns: 'entry',
37
+ corejs: 3,
38
+ modules: false,
39
+ exclude: ['transform-typeof-symbol']
40
+ }
41
+ ]
42
+ ].filter(Boolean),
43
+ plugins: [
44
+ 'babel-plugin-macros',
45
+ '@babel/plugin-syntax-dynamic-import',
46
+ isTestEnv && 'babel-plugin-dynamic-import-node',
47
+ '@babel/plugin-transform-destructuring',
48
+ [
49
+ '@babel/plugin-proposal-class-properties',
50
+ {
51
+ loose: true
52
+ }
53
+ ],
54
+ [
55
+ '@babel/plugin-proposal-object-rest-spread',
56
+ {
57
+ useBuiltIns: true
58
+ }
59
+ ],
60
+ [
61
+ '@babel/plugin-transform-runtime',
62
+ {
63
+ helpers: false,
64
+ regenerator: true,
65
+ corejs: false
66
+ }
67
+ ],
68
+ [
69
+ '@babel/plugin-transform-regenerator',
70
+ {
71
+ async: false
72
+ }
73
+ ]
74
+ ].filter(Boolean)
75
+ }
76
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ plugins: [
3
+ require('postcss-import'),
4
+ require('postcss-flexbugs-fixes'),
5
+ require('postcss-preset-env')({
6
+ autoprefixer: {
7
+ flexbox: 'no-2009'
8
+ },
9
+ stage: 3
10
+ })
11
+ ]
12
+ }
@@ -0,0 +1,61 @@
1
+ const path = require("path")
2
+
3
+ const prefix = "VITE_RB"
4
+
5
+ // Build related items
6
+ const MOUNT_PATH = process.env[`${prefix}_MOUNT_PATH`]
7
+ const OUTPUT_DIR = process.env[`${prefix}_OUTPUT_DIR`]
8
+ const BUILD_DIR = process.env[`${prefix}_BUILD_DIR`]
9
+ const ENTRYPOINTS_DIR = process.env[`${prefix}_ENTRYPOINTS_DIR`]
10
+
11
+ // Config files
12
+ const POSTCSS_CONFIG = process.env[`${prefix}_POSTCSS_CONFIG_FILE`]
13
+
14
+ // Dev server stuff
15
+ const HOSTNAME = process.env[`${prefix}_HOSTNAME`]
16
+ const HTTPS = process.env[`${prefix}_HTTPS`]
17
+ const PORT = process.env[`${prefix}_PORT`]
18
+
19
+ const mount = {
20
+ [MOUNT_PATH]: `/${OUTPUT_DIR}`
21
+ }
22
+
23
+ const installOptions = {
24
+ NODE_ENV: true,
25
+ }
26
+
27
+ const devOptions = {
28
+ hostname: HOSTNAME,
29
+ port: parseInt(PORT, 10),
30
+ open: "none",
31
+ out: BUILD_DIR,
32
+ secure: (HTTPS === "true")
33
+ }
34
+
35
+ const buildOptions = {
36
+ clean: true,
37
+ baseUrl: `/`,
38
+ metaDir: path.join(OUTPUT_DIR, "__snowpack__"),
39
+ webModulesUrl: path.join(OUTPUT_DIR, "web_modules")
40
+ }
41
+
42
+ const plugins = [
43
+ [
44
+ "@snowpack/plugin-build-script",
45
+ {
46
+ "cmd": `postcss --config ${POSTCSS_CONFIG}`,
47
+ "watch": "$1 --watch",
48
+ "input": [".css"],
49
+ "output": [".css"]
50
+ }
51
+ ],
52
+ ]
53
+
54
+ module.exports = {
55
+ mount,
56
+ plugins: plugins,
57
+ installOptions,
58
+ devOptions,
59
+ buildOptions,
60
+ }
61
+
@@ -0,0 +1,6 @@
1
+ Spring.watch(
2
+ ".ruby-version",
3
+ ".rbenv-vars",
4
+ "tmp/restart.txt",
5
+ "tmp/caching-dev.txt"
6
+ )
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
+ # Character.create(name: 'Luke', movie: movies.first)
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "rails_without_webpack",
3
+ "private": true,
4
+ "dependencies": {
5
+ "@rails/actioncable": "^6.0.0",
6
+ "@rails/activestorage": "^6.0.0",
7
+ "@rails/ujs": "^6.0.0",
8
+ "postcss": "^8.1.1",
9
+ "postcss-cli": "^8.0.0",
10
+ "postcss-flexbugs-fixes": "^4.2.1",
11
+ "postcss-import": "^12.0.1",
12
+ "postcss-preset-env": "^6.7.0",
13
+ "vite_rb": "^0.0.1-alpha1",
14
+ "stimulus": "^1.1.1",
15
+ "turbolinks": "^5.2.0"
16
+ },
17
+ "version": "0.1.0",
18
+ "devDependencies": {
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5
+ end
@@ -0,0 +1,11 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
4
+ # test "connects with cookies" do
5
+ # cookies.signed[:user_id] = 42
6
+ #
7
+ # connect
8
+ #
9
+ # assert_equal connection.user_id, "42"
10
+ # end
11
+ end
@@ -0,0 +1,8 @@
1
+ require "test_helper"
2
+
3
+ class ChatChannelTest < ActionCable::Channel::TestCase
4
+ # test "subscribes" do
5
+ # subscribe
6
+ # assert subscription.confirmed?
7
+ # end
8
+ end
@@ -0,0 +1,8 @@
1
+ require "test_helper"
2
+
3
+ class StaticPagesControllerTest < ActionDispatch::IntegrationTest
4
+ test "should get index" do
5
+ get static_pages_index_url
6
+ assert_response :success
7
+ end
8
+ end