minitest-rails 3.0.0 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +5 -0
  3. data/LICENSE +1 -1
  4. data/README.md +117 -0
  5. data/UPDATING.md +31 -0
  6. data/lib/generators/minitest.rb +17 -4
  7. data/lib/generators/minitest/controller/controller_generator.rb +6 -9
  8. data/lib/generators/minitest/controller/templates/{controller_spec.rb → functional_spec.rb.tt} +4 -4
  9. data/lib/generators/minitest/controller/templates/{controller_test.rb → functional_test.rb.tt} +3 -3
  10. data/lib/generators/minitest/generator/generator_generator.rb +3 -8
  11. data/lib/generators/minitest/generator/templates/{generator_spec.rb → generator_spec.rb.tt} +2 -2
  12. data/lib/generators/minitest/generator/templates/{generator_test.rb → generator_test.rb.tt} +1 -2
  13. data/lib/generators/minitest/helper/helper_generator.rb +5 -3
  14. data/lib/generators/minitest/install/install_generator.rb +21 -8
  15. data/lib/generators/minitest/install/templates/test/application_system_test_case.rb.tt +10 -0
  16. data/lib/generators/minitest/install/templates/test/channels/application_cable/connection_test.rb.tt +23 -0
  17. data/lib/generators/minitest/install/templates/test/test_helper.rb.tt +23 -0
  18. data/lib/generators/minitest/integration/integration_generator.rb +12 -9
  19. data/lib/generators/minitest/integration/templates/integration_spec.rb.tt +9 -0
  20. data/lib/generators/minitest/integration/templates/integration_test.rb.tt +9 -0
  21. data/lib/generators/minitest/job/job_generator.rb +13 -10
  22. data/lib/generators/minitest/job/templates/unit_spec.rb.tt +9 -0
  23. data/lib/generators/minitest/job/templates/{job_test.rb → unit_test.rb.tt} +3 -3
  24. data/lib/generators/minitest/mailer/mailer_generator.rb +8 -11
  25. data/lib/generators/minitest/mailer/templates/functional_spec.rb.tt +21 -0
  26. data/lib/generators/minitest/mailer/templates/{mailer_test.rb → functional_test.rb.tt} +3 -3
  27. data/lib/generators/minitest/mailer/templates/{preview.rb → preview.rb.tt} +0 -0
  28. data/lib/generators/minitest/model/model_generator.rb +9 -12
  29. data/lib/generators/minitest/model/templates/{fixtures.yml → fixtures.yml.tt} +3 -3
  30. data/lib/generators/minitest/model/templates/unit_spec.rb.tt +9 -0
  31. data/lib/generators/minitest/model/templates/unit_test.rb.tt +9 -0
  32. data/lib/generators/minitest/plugin/plugin_generator.rb +15 -0
  33. data/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt +15 -0
  34. data/lib/generators/minitest/plugin/templates/test_helper.rb +2 -0
  35. data/lib/generators/minitest/scaffold/scaffold_generator.rb +28 -23
  36. data/lib/generators/minitest/scaffold/templates/api_functional_spec.rb.tt +42 -0
  37. data/lib/generators/minitest/scaffold/templates/api_functional_test.rb.tt +44 -0
  38. data/lib/generators/minitest/scaffold/templates/functional_spec.rb.tt +52 -0
  39. data/lib/generators/minitest/scaffold/templates/{controller_test.rb → functional_test.rb.tt} +16 -16
  40. data/lib/generators/minitest/scaffold/templates/system_spec.rb.tt +55 -0
  41. data/lib/generators/minitest/scaffold/templates/system_test.rb.tt +57 -0
  42. data/lib/generators/minitest/system/system_generator.rb +25 -0
  43. data/lib/generators/minitest/system/templates/application_system_test_case.rb.tt +10 -0
  44. data/lib/generators/minitest/system/templates/system_spec.rb.tt +9 -0
  45. data/lib/generators/minitest/system/templates/system_test.rb.tt +9 -0
  46. data/lib/minitest/rails.rb +76 -105
  47. data/lib/minitest/rails/assertions.rb +6 -906
  48. data/lib/minitest/rails/assertions/action_cable.rb +232 -0
  49. data/lib/minitest/rails/assertions/action_dispatch.rb +356 -0
  50. data/lib/minitest/rails/assertions/action_mailer.rb +153 -0
  51. data/lib/minitest/rails/assertions/action_view.rb +356 -0
  52. data/lib/minitest/rails/assertions/active_job.rb +151 -0
  53. data/lib/minitest/rails/assertions/active_support.rb +57 -0
  54. data/lib/minitest/rails/capybara.rb +17 -0
  55. data/lib/minitest/rails/expectations.rb +5 -565
  56. data/lib/minitest/rails/expectations/action_cable.rb +197 -0
  57. data/lib/minitest/rails/expectations/action_dispatch.rb +307 -0
  58. data/lib/minitest/rails/expectations/action_mailer.rb +175 -0
  59. data/lib/minitest/rails/expectations/active_job.rb +182 -0
  60. data/lib/minitest/rails/expectations/active_support.rb +73 -0
  61. data/lib/minitest/rails/parallelize.rb +41 -0
  62. data/lib/minitest/rails/railtie.rb +3 -2
  63. data/lib/minitest/rails/version.rb +1 -1
  64. metadata +87 -92
  65. data/.autotest +0 -23
  66. data/.gemtest +0 -0
  67. data/.travis.yml +0 -25
  68. data/CHANGELOG.rdoc +0 -223
  69. data/Gemfile +0 -7
  70. data/Manifest.txt +0 -76
  71. data/README.rdoc +0 -110
  72. data/Rakefile +0 -30
  73. data/gemfiles/5.0.gemfile +0 -5
  74. data/gemfiles/head.gemfile +0 -5
  75. data/lib/generators/.document +0 -0
  76. data/lib/generators/minitest/install/templates/test_helper.rb +0 -19
  77. data/lib/generators/minitest/integration/templates/integration_spec.rb +0 -8
  78. data/lib/generators/minitest/integration/templates/integration_test.rb +0 -7
  79. data/lib/generators/minitest/job/templates/job_spec.rb +0 -9
  80. data/lib/generators/minitest/mailer/templates/mailer_spec.rb +0 -20
  81. data/lib/generators/minitest/model/templates/model_spec.rb +0 -11
  82. data/lib/generators/minitest/model/templates/model_test.rb +0 -13
  83. data/lib/generators/minitest/scaffold/templates/api_controller_spec.rb +0 -42
  84. data/lib/generators/minitest/scaffold/templates/api_controller_test.rb +0 -44
  85. data/lib/generators/minitest/scaffold/templates/controller_spec.rb +0 -52
  86. data/lib/minitest/rails/constant_lookup.rb +0 -52
  87. data/lib/minitest/rails/controller.rb +0 -14
  88. data/minitest-rails.gemspec +0 -48
  89. data/tasks/test.rake +0 -29
  90. data/test/generators/test_controller_generator.rb +0 -58
  91. data/test/generators/test_generator_generator.rb +0 -58
  92. data/test/generators/test_helper_generator.rb +0 -34
  93. data/test/generators/test_install_generator.rb +0 -27
  94. data/test/generators/test_job_generator.rb +0 -45
  95. data/test/generators/test_mailer_generator.rb +0 -42
  96. data/test/generators/test_model_generator.rb +0 -80
  97. data/test/generators/test_scaffold_generator.rb +0 -26
  98. data/test/helper.rb +0 -93
  99. data/test/rails/action_dispatch/test_assertions.rb +0 -39
  100. data/test/rails/action_dispatch/test_expectations.rb +0 -39
  101. data/test/rails/action_dispatch/test_spec_type.rb +0 -49
  102. data/test/rails/action_mailer/test_mailers.rb +0 -109
  103. data/test/rails/action_mailer/test_spec_type.rb +0 -47
  104. data/test/rails/action_view/test_helpers.rb +0 -73
  105. data/test/rails/action_view/test_spec_type.rb +0 -58
  106. data/test/rails/active_job/test_assertions.rb +0 -46
  107. data/test/rails/active_job/test_expectations.rb +0 -55
  108. data/test/rails/active_job/test_spec_type.rb +0 -49
  109. data/test/rails/active_support/test_assertions.rb +0 -31
  110. data/test/rails/active_support/test_expectations.rb +0 -21
  111. data/test/rails/active_support/test_spec_type.rb +0 -28
  112. data/test/rails/generators/test_spec_type.rb +0 -45
  113. data/test/rails/test_constant_lookup.rb +0 -58
  114. data/test/test_sanity.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b4d24ef4761098d8b1b988493155fb73ba0c480a
4
- data.tar.gz: a6c181821e2331d20f05698fb632650c61d50db3
2
+ SHA256:
3
+ metadata.gz: 78e958e461d48ea3431d57feacc0d7613c2a1dc0b815ba6fb31ea4d9d9511f16
4
+ data.tar.gz: f99591d512948869e17fca5264d553da2272b76a6c1def75367d7f6987a0f886
5
5
  SHA512:
6
- metadata.gz: 25066c06f3a6097e3a026b8576f3dc69a1b38988f37640f4ecb59868775d54ebfa67e7ff5150b74b12cd60fa28d1f22c17f236bbffbf7ad087c4a07937200892
7
- data.tar.gz: 567cda05348d00933ff39b9175011b58315a83ac4c7959df168ed8264c7bce9d2b54fc1d46b086a742268f007c99fb06a0678ad86cf7e209837206a96f7ab1c2
6
+ metadata.gz: 74cf33e9e358ccc69aaac3bfce4bad6a0f805a7f6cc32ee1bfc33b68accf26d7d279b329e625e6a027ad6cd638c78108025f03287d5a45c3f29d5d93ea3e27b0
7
+ data.tar.gz: c4a13fde827bc6a0185ecd82b123e318b9f3f576c1d4c9b41b75f58cbb39129ba59af481cf4b79f746134927c08f93907efe4ef59c52258a6c0da8abd0529d93
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changes
2
+
3
+ ### 6.1.0 / 2020-12-14
4
+
5
+ Support Rails 6.1.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Mike Moore
1
+ Copyright (c) 2019 Mike Moore
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # minitest-rails
2
+
3
+ Minitest integration for Rails 6.1
4
+
5
+ [![Build Status](https://circleci.com/gh/blowmage/minitest-rails.svg?style=svg)](https://circleci.com/gh/blowmage/minitest-rails)
6
+ [![Code Climate](https://codeclimate.com/github/blowmage/minitest-rails.png)](https://codeclimate.com/github/blowmage/minitest-rails)
7
+
8
+ ## Install
9
+
10
+ `gem install minitest-rails`
11
+
12
+ This installs the following gems:
13
+
14
+ * `minitest`
15
+
16
+ ## Configure
17
+
18
+ Create a new rails app:
19
+
20
+ `rails new MyApp`
21
+
22
+ ### Choosing a version
23
+
24
+ If you are running Rails 6.x, specify a corresponding 6.x release in the Gemfile. For example, if you are using Rails 6.1 you will specify:
25
+
26
+ ```ruby
27
+ gem "minitest-rails", "~> 6.1.0"
28
+ ```
29
+
30
+ If you are running Rails 5.x, specify a corresponding 5.x release in the Gemfile. For example, if you are using Rails 5.2 you will specify:
31
+
32
+ ```ruby
33
+ gem "minitest-rails", "~> 5.2.0"
34
+ ```
35
+
36
+ Or, if you prefer to run the previous release for Rails 5.x, specify a 3.x release in the Gemfile:
37
+
38
+ ```ruby
39
+ gem "minitest-rails", "~> 3.0"
40
+ ```
41
+
42
+ If you are running Rails 4.1 or 4.2, specify a 2.x release in the Gemfile:
43
+
44
+ ```ruby
45
+ gem "minitest-rails", "~> 2.0"
46
+ ```
47
+
48
+ If you are running Rails 4.0 or earlier, specify a 1.x release in the Gemfile:
49
+
50
+ ```ruby
51
+ gem "minitest-rails", "~> 1.0"
52
+ ```
53
+
54
+ ### Installing
55
+
56
+ Next run the installation generator with the following:
57
+
58
+ `rails generate minitest:install`
59
+
60
+ This will add the `test_helper.rb` file to the `test` directory.
61
+
62
+ ## Usage
63
+
64
+ This project aims to enable Minitest within the Rails TestCase classes.
65
+ Your test will continue to inherit from `ActiveSupport::TestCase`, which will now support the spec DSL.
66
+ You can generate test files using the `Minitest::Spec` DSL with the standard model, controller, resource, and other generators:
67
+
68
+ `rails generate model User`
69
+
70
+ And you can specify generating the tests without the `Minitest::Spec` DSL on any of the generators by providing the `--no-spec` option:
71
+
72
+ `rails generate model User --no-spec`
73
+
74
+ And you can specify not generating the fixture for a model by providing the `--skip-fixture` option:
75
+
76
+ `rails generate model User --skip-fixture`
77
+
78
+ You can also set these as defaults by adding the following to the `config/application.rb` file:
79
+
80
+ ```ruby
81
+ config.generators do |g|
82
+ g.test_framework :minitest, spec: false, fixture: false
83
+ end
84
+ ```
85
+
86
+ ## Running Tests
87
+
88
+ To run your tests use the `rails test` that ship with rails.
89
+
90
+ ## Get Involved
91
+
92
+ Join the mailing list to get help or offer suggestions.
93
+
94
+ https://groups.google.com/group/minitest-rails
95
+
96
+ ## License
97
+
98
+ Copyright (c) 2019 Mike Moore
99
+
100
+ Permission is hereby granted, free of charge, to any person obtaining
101
+ a copy of this software and associated documentation files (the
102
+ "Software"), to deal in the Software without restriction, including
103
+ without limitation the rights to use, copy, modify, merge, publish,
104
+ distribute, sublicense, and/or sell copies of the Software, and to
105
+ permit persons to whom the Software is furnished to do so, subject to
106
+ the following conditions:
107
+
108
+ The above copyright notice and this permission notice shall be
109
+ included in all copies or substantial portions of the Software.
110
+
111
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
112
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
113
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
114
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
115
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
116
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
117
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/UPDATING.md ADDED
@@ -0,0 +1,31 @@
1
+ # Updating from previous versions
2
+
3
+ If you are upgrading from previous versions, then there are some subtle changes that you should be aware of. Do you see a change that is not listed in this document? Then please [open an issue](https://github.com/blowmage/minitest-rails/issues/new) to add it.
4
+
5
+ ## Spec DSL
6
+
7
+ The `describe` block should be passed the actual constant and not a string of the constant's name. This works:
8
+
9
+ ```ruby
10
+ describe WidgetsController do
11
+ ```
12
+
13
+ But this does not:
14
+
15
+ ```ruby
16
+ describe "WidgetsController" do
17
+ ```
18
+
19
+ If you want to pass a string, then you must provide an additional description to tell the Spec DSL what test class to use:
20
+
21
+ ```ruby
22
+ describe "WidgetsController", :controller do
23
+ ```
24
+
25
+ ## Expectations
26
+
27
+ The signature for the expectation `must_change` has changed from earlier versions of minitest-rails. This is because the expectation used to refer to the `assert_difference` assertion, but not refers to the `assert_changes` assertion added in Rails 5.1. The expectation for the `assert_difference` assertion is now `must_differ`.
28
+
29
+ ## Versioning
30
+
31
+ The minitest-rails gem now follows Rails versioning. This means minitest-rails 6.0.x works for rails 6.0.x, and minitest-rails 6.1.x will work for rails 6.1.x.
@@ -1,17 +1,30 @@
1
- require 'rails/generators/named_base'
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators/named_base"
2
4
 
3
5
  module Minitest
4
6
  module Generators
5
7
  class Base < ::Rails::Generators::NamedBase #:nodoc:
6
8
  class_option :spec, type: :boolean, default: true,
7
9
  desc: "Use Minitest::Spec DSL"
10
+ class_option :spec_expectation_monad, type: :string, default: "value",
11
+ desc: "Spec DSL's expectation value mondad (options: value, expect, _)"
8
12
 
9
13
  def self.default_source_root
10
- File.expand_path(File.join(File.dirname(__FILE__), 'minitest', generator_name, 'templates'))
14
+ File.expand_path(File.join(File.dirname(__FILE__), "minitest", generator_name, "templates"))
11
15
  end
12
16
 
13
- def show_helper
14
- "#{singular_table_name}_url(#{singular_table_name})"
17
+ def test_file_type
18
+ return "spec" if options[:spec]
19
+
20
+ "test"
21
+ end
22
+
23
+ def spec_expectation_monad
24
+ monad = options[:spec_expectation_monad]
25
+ return monad if %w[value expect _].include? monad
26
+
27
+ "value"
15
28
  end
16
29
  end
17
30
  end
@@ -1,18 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "generators/minitest"
2
4
 
3
- module Minitest
4
- module Generators
5
- class ControllerGenerator < Base
5
+ module Minitest # :nodoc:
6
+ module Generators # :nodoc:
7
+ class ControllerGenerator < Base # :nodoc:
6
8
  argument :actions, type: :array, default: [], banner: "action action"
7
9
  check_class_collision suffix: "ControllerTest"
8
10
 
9
11
  def create_test_files
10
- if options[:spec]
11
- template_file = "controller_spec.rb"
12
- else
13
- template_file = "controller_test.rb"
14
- end
15
- template template_file,
12
+ template "functional_#{test_file_type}.rb",
16
13
  File.join("test/controllers", class_path, "#{file_name}_controller_test.rb")
17
14
  end
18
15
  end
@@ -7,14 +7,14 @@ describe <%= class_name %>Controller do
7
7
 
8
8
  <% end -%>
9
9
  <% if actions.empty? -%>
10
- # it "must be a real test" do
11
- # flunk "Need real tests"
10
+ # it "does a thing" do
11
+ # <%= spec_expectation_monad %>(1+1).must_equal 2
12
12
  # end
13
13
  <% else -%>
14
14
  <% actions.each do |action| -%>
15
- it "should get <%= action %>" do
15
+ it "must get <%= action %>" do
16
16
  get <%= url_helper_prefix %>_<%= action %>_url
17
- value(response).must_be :success?
17
+ must_respond_with :success
18
18
  end
19
19
 
20
20
  <% end -%>
@@ -7,12 +7,12 @@ class <%= class_name %>ControllerTest < ActionDispatch::IntegrationTest
7
7
 
8
8
  <% end -%>
9
9
  <% if actions.empty? -%>
10
- # def test_sanity
11
- # flunk "Need real tests"
10
+ # def test_truth
11
+ # assert true
12
12
  # end
13
13
  <% else -%>
14
14
  <% actions.each do |action| -%>
15
- def test_<%= action %>
15
+ def test_get_<%= action %>
16
16
  get <%= url_helper_prefix %>_<%= action %>_url
17
17
  assert_response :success
18
18
  end
@@ -2,22 +2,17 @@ require "generators/minitest"
2
2
 
3
3
  module Minitest
4
4
  module Generators
5
- class GeneratorGenerator < Base
5
+ class GeneratorGenerator < Base # :nodoc:
6
6
  check_class_collision suffix: "GeneratorTest"
7
7
 
8
8
  class_option :namespace, type: :boolean, default: true,
9
9
  desc: "Namespace generator under lib/generators/name"
10
10
 
11
11
  def create_generator_files
12
- if options[:spec]
13
- template_file = "generator_spec.rb"
14
- else
15
- template_file = "generator_test.rb"
16
- end
17
- template template_file, File.join("test/lib/generators", class_path, "#{file_name}_generator_test.rb")
12
+ template "generator_#{test_file_type}.rb", File.join("test/lib/generators", class_path, "#{file_name}_generator_test.rb")
18
13
  end
19
14
 
20
- protected
15
+ private
21
16
 
22
17
  def generator_path
23
18
  if options[:namespace]
@@ -3,11 +3,11 @@ require "<%= generator_path %>"
3
3
 
4
4
  <% module_namespacing do -%>
5
5
  describe <%= class_name %>Generator do
6
+ #tests <%= class_name %>Generator
6
7
  destination Rails.root.join("tmp/generators")
7
8
  setup :prepare_destination
8
9
 
9
- # it "generator runs without errors" do
10
- # # No error raised? It passes.
10
+ # it "runs without errors" do
11
11
  # run_generator ["arguments"]
12
12
  # end
13
13
  end
@@ -7,8 +7,7 @@ class <%= class_name %>GeneratorTest < Rails::Generators::TestCase
7
7
  destination Rails.root.join("tmp/generators")
8
8
  setup :prepare_destination
9
9
 
10
- # def test_generator_runs
11
- # # No error raised? It passes.
10
+ # def test_generator_runs_without_errors
12
11
  # run_generator ["arguments"]
13
12
  # end
14
13
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "generators/minitest"
2
4
 
3
- module Minitest
4
- module Generators
5
- class HelperGenerator < Base
5
+ module Minitest # :nodoc:
6
+ module Generators # :nodoc:
7
+ class HelperGenerator < Base # :nodoc:
6
8
  # Rails does not generate anything here.
7
9
  end
8
10
  end
@@ -1,21 +1,34 @@
1
- require 'rails/generators'
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "rails/generators/app_base"
2
5
 
3
6
  module Minitest
4
7
  module Generators
5
- class InstallGenerator < ::Rails::Generators::Base
8
+ class InstallGenerator < ::Rails::Generators::AppBase
6
9
  class_option :skip_active_record, type: :boolean, default: false, desc: "Skip Active Record files"
7
10
 
8
- desc <<DESC
9
- Description:
10
- Copy minitest files to your application.
11
- DESC
11
+ desc <<~DESC
12
+ Description:
13
+ Copy minitest files to your application.
14
+ DESC
12
15
 
13
16
  def self.source_root
14
- @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
17
+ @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), "templates"))
15
18
  end
16
19
 
17
20
  def copy_minitest_files
18
- template 'test_helper.rb', File.join("test", "test_helper.rb")
21
+ empty_directory_with_keep_file "test/fixtures"
22
+ empty_directory_with_keep_file "test/fixtures/files"
23
+ empty_directory_with_keep_file "test/controllers"
24
+ empty_directory_with_keep_file "test/mailers"
25
+ empty_directory_with_keep_file "test/models"
26
+ empty_directory_with_keep_file "test/helpers"
27
+ empty_directory_with_keep_file "test/integration"
28
+
29
+ template "test/channels/application_cable/connection_test.rb"
30
+ template "test/application_system_test_case.rb"
31
+ template "test/test_helper.rb"
19
32
  end
20
33
  end
21
34
  end
@@ -0,0 +1,10 @@
1
+ require "test_helper"
2
+ require "minitest/rails/capybara"
3
+
4
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
5
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
6
+
7
+ register_spec_type(self) do |desc, *addl|
8
+ addl.include? :system
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ require "test_helper"
2
+
3
+ <%- if options[:spec] -%>
4
+ describe "ApplicationCable Connection", :connection do
5
+ # it "connects with cookies" do
6
+ # cookies.signed[:user_id] = 42
7
+ #
8
+ # connect
9
+ #
10
+ # connection.user_id.must_equal "42"
11
+ # end
12
+ end
13
+ <%- else -%>
14
+ class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
15
+ # def test_connects_with_cookies
16
+ # cookies.signed[:user_id] = 42
17
+ #
18
+ # connect
19
+ #
20
+ # assert_equal connection.user_id, "42"
21
+ # end
22
+ end
23
+ <%- end -%>
@@ -0,0 +1,23 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+ require_relative "../config/environment"
3
+ require "rails/test_help"
4
+ require "minitest/rails"
5
+
6
+ # Consider setting MT_NO_EXPECTATIONS to not add expectations to Object.
7
+ # ENV["MT_NO_EXPECTATIONS"] = true
8
+
9
+ class ActiveSupport::TestCase
10
+ # Run tests in parallel with specified workers
11
+ <% if defined?(JRUBY_VERSION) || Gem.win_platform? -%>
12
+ parallelize(workers: :number_of_processors, with: :threads)
13
+ <%- else -%>
14
+ parallelize(workers: :number_of_processors)
15
+ <% end -%>
16
+
17
+ <% unless options[:skip_active_record] -%>
18
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
19
+ fixtures :all
20
+
21
+ <% end -%>
22
+ # Add more helper methods to be used by all tests here...
23
+ end