minitest-spec-rails 5.4.0 → 6.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +35 -0
  3. data/.rubocop.yml +26 -0
  4. data/Appraisals +10 -6
  5. data/CHANGELOG.md +25 -1
  6. data/Gemfile +0 -1
  7. data/README.md +23 -35
  8. data/Rakefile +6 -6
  9. data/gemfiles/{rails42.gemfile → rails_v5.1.x.gemfile} +3 -2
  10. data/gemfiles/rails_v5.1.x.gemfile.lock +128 -0
  11. data/gemfiles/{rails50.gemfile → rails_v5.2.x.gemfile} +3 -2
  12. data/gemfiles/rails_v5.2.x.gemfile.lock +136 -0
  13. data/gemfiles/{rails41.gemfile → rails_v6.0.x.gemfile} +3 -2
  14. data/gemfiles/rails_v6.0.x.gemfile.lock +152 -0
  15. data/lib/minitest-spec-rails/dsl.rb +5 -9
  16. data/lib/minitest-spec-rails/init/action_controller.rb +3 -7
  17. data/lib/minitest-spec-rails/init/action_dispatch.rb +1 -3
  18. data/lib/minitest-spec-rails/init/action_mailer.rb +2 -7
  19. data/lib/minitest-spec-rails/init/action_view.rb +1 -5
  20. data/lib/minitest-spec-rails/init/active_job.rb +3 -8
  21. data/lib/minitest-spec-rails/init/active_support.rb +8 -10
  22. data/lib/minitest-spec-rails/init/mini_shoulda.rb +2 -6
  23. data/lib/minitest-spec-rails/parallelize.rb +30 -0
  24. data/lib/minitest-spec-rails/railtie.rb +24 -21
  25. data/lib/minitest-spec-rails/version.rb +1 -1
  26. data/minitest-spec-rails.gemspec +7 -7
  27. data/test/cases/action_controller_test.rb +7 -10
  28. data/test/cases/action_dispatch_test.rb +10 -13
  29. data/test/cases/action_mailer_test.rb +7 -10
  30. data/test/cases/action_view_test.rb +13 -16
  31. data/test/cases/active_job_test.rb +38 -36
  32. data/test/cases/active_support_test.rb +22 -12
  33. data/test/cases/mini_shoulda_test.rb +0 -4
  34. data/test/dummy_app/app/assets/config/manifest.js +1 -0
  35. data/test/dummy_app/app/controllers/application_controller.rb +1 -3
  36. data/test/dummy_app/app/controllers/users_controller.rb +1 -3
  37. data/test/dummy_app/app/helpers/application_helper.rb +0 -1
  38. data/test/dummy_app/app/helpers/foos_helper.rb +3 -1
  39. data/test/dummy_app/app/helpers/users_helper.rb +1 -3
  40. data/test/dummy_app/app/mailers/user_mailer.rb +2 -4
  41. data/test/dummy_app/app/models/post.rb +0 -3
  42. data/test/dummy_app/app/models/user.rb +0 -3
  43. data/test/dummy_app/config/routes.rb +1 -1
  44. data/test/dummy_app/init.rb +13 -6
  45. data/test/dummy_tests/application_controller_test.rb +3 -9
  46. data/test/dummy_tests/foos_helper_test.rb +0 -3
  47. data/test/dummy_tests/integration_test.rb +2 -8
  48. data/test/dummy_tests/special_users_controller_test.rb +0 -2
  49. data/test/dummy_tests/user_mailer_test.rb +4 -10
  50. data/test/dummy_tests/user_test.rb +2 -8
  51. data/test/dummy_tests/users_controller_test.rb +1 -3
  52. data/test/dummy_tests/users_helper_test.rb +2 -8
  53. data/test/support/shared_test_case_behavior.rb +4 -7
  54. data/test/test_helper.rb +0 -3
  55. data/test/test_helper_dummy.rb +5 -6
  56. metadata +20 -16
  57. data/.travis.yml +0 -22
  58. data/gemfiles/rails41.gemfile.lock +0 -96
  59. data/gemfiles/rails42.gemfile.lock +0 -123
  60. data/gemfiles/rails50.gemfile.lock +0 -133
@@ -1,9 +1,7 @@
1
1
  module UsersHelper
2
-
3
2
  def render_users_list(users)
4
3
  content_tag :ul do
5
- users.map{ |user| content_tag :li, user.email }.join.html_safe
4
+ users.map { |user| content_tag :li, user.email }.join.html_safe
6
5
  end
7
6
  end
8
-
9
7
  end
@@ -1,10 +1,8 @@
1
1
  class UserMailer < ActionMailer::Base
2
-
3
- default :from => 'rails@minitest.spec'
2
+ default from: 'rails@minitest.spec'
4
3
 
5
4
  def welcome(user)
6
5
  @user = user
7
- mail :to => @user.email, :subject => 'Welcome', :body => "Welcome to MiniTest::Spec #{@user.email}!"
6
+ mail to: @user.email, subject: 'Welcome', body: "Welcome to MiniTest::Spec #{@user.email}!"
8
7
  end
9
-
10
8
  end
@@ -1,6 +1,3 @@
1
1
  class Post < ActiveRecord::Base
2
-
3
2
  belongs_to :user
4
-
5
-
6
3
  end
@@ -1,6 +1,3 @@
1
1
  class User < ActiveRecord::Base
2
-
3
2
  has_many :posts
4
-
5
-
6
3
  end
@@ -1,4 +1,4 @@
1
1
  Dummy::Application.routes.draw do
2
- root :to => 'application#index'
2
+ root to: 'application#index'
3
3
  resources :users
4
4
  end
@@ -1,18 +1,24 @@
1
- ENV["RAILS_ENV"] ||= "test"
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __FILE__)
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__)
3
3
  require 'bundler/setup'
4
4
  require 'rails/all'
5
5
  Bundler.require(:default, Rails.env)
6
6
 
7
7
  module Dummy
8
8
  class Application < ::Rails::Application
9
-
10
9
  # Basic Engine
11
10
  config.root = File.join __FILE__, '..'
12
11
  config.cache_store = :memory_store
13
12
  config.assets.enabled = false
14
- config.secret_token = '012345678901234567890123456789'
13
+ if Rails.version > '5.0'
14
+ config.secret_key_base = '012345678901234567890123456789'
15
+ else
16
+ config.secret_token = '012345678901234567890123456789'
17
+ end
15
18
  config.active_support.test_order = :random
19
+ if config.active_record.sqlite3.respond_to?(:represent_boolean_as_integer)
20
+ config.active_record.sqlite3.represent_boolean_as_integer = true
21
+ end
16
22
 
17
23
  # Mimic Test Environment Config.
18
24
  config.whiny_nils = true if Rails.version < '4.0'
@@ -27,13 +33,14 @@ module Dummy
27
33
  config.dependency_loading = true
28
34
  config.preload_frameworks = true
29
35
  config.eager_load = true
30
- config.secret_key_base = '012345678901234567890123456789'
31
36
 
32
37
  # Custom
33
38
  config.minitest_spec_rails.mini_shoulda = true
34
-
35
39
  end
36
40
  end
37
41
 
38
42
  Dummy::Application.initialize!
39
43
  require 'rails/test_help'
44
+
45
+ # Avoids local NoMethodError: undefined method `split' for nil:NilClass
46
+ Rails.backtrace_cleaner.remove_silencers!
@@ -3,7 +3,6 @@ require 'test_helper_dummy'
3
3
  module ApplicationControllerTests
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
-
7
6
  before { get :index }
8
7
 
9
8
  it 'works' do
@@ -12,7 +11,7 @@ module ApplicationControllerTests
12
11
  end
13
12
 
14
13
  it 'allows custom assertions' do
15
- assert_select 'h1', :text => 'Rendered MiniTest::Spec'
14
+ assert_select 'h1', text: 'Rendered MiniTest::Spec'
16
15
  end
17
16
 
18
17
  it 'can find the controller_class' do
@@ -24,7 +23,6 @@ module ApplicationControllerTests
24
23
  end
25
24
 
26
25
  describe 'nested 1' do
27
-
28
26
  it('works') { skip }
29
27
 
30
28
  it 'can find the controller_class' do
@@ -32,13 +30,9 @@ module ApplicationControllerTests
32
30
  end
33
31
 
34
32
  describe 'nested 2' do
35
-
36
33
  it('works') { skip }
37
-
38
34
  end
39
-
40
35
  end
41
-
42
36
  end
43
37
  end
44
38
 
@@ -50,12 +44,12 @@ class ApplicationControllerTest < ActionController::TestCase
50
44
  end
51
45
  describe 'level 1' do
52
46
  it 'reflects' do
53
- described_class.must_equal ApplicationController
47
+ described_class.must_equal ApplicationController
54
48
  self.class.described_class.must_equal ApplicationController
55
49
  end
56
50
  describe 'level 2' do
57
51
  it 'reflects' do
58
- described_class.must_equal ApplicationController
52
+ described_class.must_equal ApplicationController
59
53
  self.class.described_class.must_equal ApplicationController
60
54
  end
61
55
  end
@@ -1,7 +1,6 @@
1
1
  require 'test_helper_dummy'
2
2
 
3
3
  class FoosHelperTest < ActionView::TestCase
4
-
5
4
  it 'allows path and url helpers' do
6
5
  users_path_helper.must_equal '/users'
7
6
  users_url_helper.must_equal 'http://test.host/users'
@@ -12,6 +11,4 @@ class FoosHelperTest < ActionView::TestCase
12
11
  assert passes
13
12
  end
14
13
  end
15
-
16
14
  end
17
-
@@ -3,7 +3,6 @@ require 'test_helper_dummy'
3
3
  module IntegrationTests
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
-
7
6
  fixtures :all
8
7
 
9
8
  it 'works' do
@@ -12,7 +11,7 @@ module IntegrationTests
12
11
  end
13
12
 
14
13
  it 'works with assert_routing' do
15
- assert_routing '/', :controller => 'application', :action => 'index'
14
+ assert_routing '/', controller: 'application', action: 'index'
16
15
  end
17
16
 
18
17
  it 'can find the app' do
@@ -20,7 +19,6 @@ module IntegrationTests
20
19
  end
21
20
 
22
21
  describe 'nested 1' do
23
-
24
22
  it('works') { skip }
25
23
 
26
24
  it 'can find the app' do
@@ -28,13 +26,9 @@ module IntegrationTests
28
26
  end
29
27
 
30
28
  describe 'nested 2' do
31
-
32
29
  it('works') { skip }
33
-
34
30
  end
35
-
36
31
  end
37
-
38
32
  end
39
33
  end
40
34
 
@@ -44,6 +38,6 @@ end
44
38
 
45
39
  class AppTest < ActionDispatch::IntegrationTest
46
40
  def test_homepage
47
- assert_routing '/', :controller => 'application', :action => 'index'
41
+ assert_routing '/', controller: 'application', action: 'index'
48
42
  end
49
43
  end
@@ -1,12 +1,10 @@
1
1
  require 'test_helper_dummy'
2
2
 
3
3
  class SpecialUsersControllerTest < ActionController::TestCase
4
-
5
4
  tests UsersController
6
5
 
7
6
  it 'works' do
8
7
  get :index
9
8
  assert_select 'h1', "All #{User.count} Users"
10
9
  end
11
-
12
10
  end
@@ -3,15 +3,14 @@ require 'test_helper_dummy'
3
3
  module UserMailerTests
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
-
7
6
  let(:deliveries) { ActionMailer::Base.deliveries }
8
7
  let(:user_mailer_class) { UserMailer }
9
- let(:user_email) {
8
+ let(:user_email) do
10
9
  user_mailer_class.welcome(user_ken).tap do |mail|
11
10
  laterable = Rails.version > '4.2' || Rails.version.starts_with?('4.2')
12
11
  laterable ? mail.deliver_now : mail.deliver
13
12
  end
14
- }
13
+ end
15
14
 
16
15
  it 'works' do
17
16
  deliveries.must_be :empty?
@@ -31,7 +30,6 @@ module UserMailerTests
31
30
  end
32
31
 
33
32
  describe 'nested 1' do
34
-
35
33
  it('works') { skip }
36
34
 
37
35
  it 'can find the mailer_class' do
@@ -39,13 +37,9 @@ module UserMailerTests
39
37
  end
40
38
 
41
39
  describe 'nested 2' do
42
-
43
40
  it('works') { skip }
44
-
45
41
  end
46
-
47
42
  end
48
-
49
43
  end
50
44
  end
51
45
 
@@ -57,12 +51,12 @@ class UserMailerTest < ActionMailer::TestCase
57
51
  end
58
52
  describe 'level 1' do
59
53
  it 'reflects' do
60
- described_class.must_equal UserMailer
54
+ described_class.must_equal UserMailer
61
55
  self.class.described_class.must_equal UserMailer
62
56
  end
63
57
  describe 'level 2' do
64
58
  it 'reflects' do
65
- described_class.must_equal UserMailer
59
+ described_class.must_equal UserMailer
66
60
  self.class.described_class.must_equal UserMailer
67
61
  end
68
62
  end
@@ -3,7 +3,6 @@ require 'test_helper_dummy'
3
3
  module UserTests
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
-
7
6
  it 'works' do
8
7
  user_ken.must_be_instance_of User
9
8
  end
@@ -17,21 +16,16 @@ module UserTests
17
16
  end
18
17
 
19
18
  describe 'nested 1' do
20
-
21
19
  it('works') { skip }
22
20
 
23
21
  describe 'nested 2' do
24
-
25
22
  it('works') { skip }
26
-
27
23
  end
28
24
 
29
25
  test 'works with test' do
30
26
  user_ken.must_be_instance_of User
31
27
  end
32
-
33
28
  end
34
-
35
29
  end
36
30
  end
37
31
 
@@ -43,12 +37,12 @@ class UserTest < ActiveSupport::TestCase
43
37
  end
44
38
  describe 'level 1' do
45
39
  it 'reflects' do
46
- described_class.must_equal User
40
+ described_class.must_equal User
47
41
  self.class.described_class.must_equal User
48
42
  end
49
43
  describe 'level 2' do
50
44
  it 'reflects' do
51
- described_class.must_equal User
45
+ described_class.must_equal User
52
46
  self.class.described_class.must_equal User
53
47
  end
54
48
  end
@@ -3,7 +3,6 @@ require 'test_helper_dummy'
3
3
  module UsersControllerTests
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
-
7
6
  it 'works' do
8
7
  get :index
9
8
  assert_select 'h1', "All #{User.count} Users"
@@ -17,9 +16,8 @@ module UsersControllerTests
17
16
  private
18
17
 
19
18
  def put_update_0
20
- rails5? ? put(:update, :params => {:id => 0}) : put(:update, :id => 0)
19
+ rails5? ? put(:update, params: { id: 0 }) : put(:update, id: 0)
21
20
  end
22
-
23
21
  end
24
22
  end
25
23
 
@@ -3,7 +3,6 @@ require 'test_helper_dummy'
3
3
  module UsersHelperTests
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
-
7
6
  let(:users_list) { render_users_list User.all }
8
7
 
9
8
  before { user_ken }
@@ -18,7 +17,6 @@ module UsersHelperTests
18
17
  end
19
18
 
20
19
  describe 'nested 1' do
21
-
22
20
  it('works') { skip }
23
21
 
24
22
  it 'can find the helper_class' do
@@ -26,13 +24,9 @@ module UsersHelperTests
26
24
  end
27
25
 
28
26
  describe 'nested 2' do
29
-
30
27
  it('works') { skip }
31
-
32
28
  end
33
-
34
29
  end
35
-
36
30
  end
37
31
  end
38
32
 
@@ -44,12 +38,12 @@ class UsersHelperTest < ActionView::TestCase
44
38
  end
45
39
  describe 'level 1' do
46
40
  it 'reflects' do
47
- described_class.must_equal UsersHelper
41
+ described_class.must_equal UsersHelper
48
42
  self.class.described_class.must_equal UsersHelper
49
43
  end
50
44
  describe 'level 2' do
51
45
  it 'reflects' do
52
- described_class.must_equal UsersHelper
46
+ described_class.must_equal UsersHelper
53
47
  self.class.described_class.must_equal UsersHelper
54
48
  end
55
49
  end
@@ -1,13 +1,12 @@
1
1
  module MiniTestSpecRails
2
2
  module SharedTestCaseBehavior
3
-
4
3
  extend ActiveSupport::Concern
5
4
 
6
5
  included do
7
6
  before { setup_dummy_schema }
8
7
  let(:app) { Dummy::Application }
9
- let(:user_ken) { User.create! :email => 'ken@metaskills.net' }
10
- let(:user_post) { Post.create! :title => 'Test Title', :body => 'Test body. Test body.', :user => user_ken}
8
+ let(:user_ken) { User.create! email: 'ken@metaskills.net' }
9
+ let(:user_post) { Post.create! title: 'Test Title', body: 'Test body. Test body.', user: user_ken }
11
10
  end
12
11
 
13
12
  private
@@ -19,17 +18,15 @@ module MiniTestSpecRails
19
18
  def setup_dummy_schema
20
19
  ActiveRecord::Base.class_eval do
21
20
  connection.instance_eval do
22
- create_table :users, :force => true do |t|
21
+ create_table :users, force: true do |t|
23
22
  t.string :email
24
23
  end
25
- create_table :posts, :force => true do |t|
24
+ create_table :posts, force: true do |t|
26
25
  t.string :title, :body
27
26
  t.integer :user_id
28
27
  end
29
28
  end
30
29
  end
31
30
  end
32
-
33
31
  end
34
32
  end
35
-
@@ -3,9 +3,6 @@ require 'support/shared_test_case_behavior'
3
3
 
4
4
  module MiniTestSpecRails
5
5
  class TestCase < MiniTest::Spec
6
-
7
6
  include MiniTestSpecRails::SharedTestCaseBehavior
8
-
9
-
10
7
  end
11
8
  end
@@ -1,9 +1,8 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActiveSupport::TestCase
4
-
5
- fixtures :all
6
- include MiniTestSpecRails::SharedTestCaseBehavior
7
-
8
-
3
+ module ActiveSupport
4
+ class TestCase
5
+ fixtures :all
6
+ include MiniTestSpecRails::SharedTestCaseBehavior
7
+ end
9
8
  end
metadata CHANGED
@@ -1,31 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-spec-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.0
4
+ version: 6.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-15 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rails
28
+ name: railties
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -80,16 +80,18 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL
84
- within your existing Rails 3 or 4 test suite.
83
+ description: |-
84
+ The minitest-spec-rails gem makes it easy to use the \
85
+ MiniTest::Spec DSL within your existing Rails test suite.
85
86
  email:
86
87
  - ken@metaskills.net
87
88
  executables: []
88
89
  extensions: []
89
90
  extra_rdoc_files: []
90
91
  files:
92
+ - ".github/workflows/ci.yml"
91
93
  - ".gitignore"
92
- - ".travis.yml"
94
+ - ".rubocop.yml"
93
95
  - Appraisals
94
96
  - CHANGELOG.md
95
97
  - CODE_OF_CONDUCT.md
@@ -97,12 +99,12 @@ files:
97
99
  - MIT-LICENSE
98
100
  - README.md
99
101
  - Rakefile
100
- - gemfiles/rails41.gemfile
101
- - gemfiles/rails41.gemfile.lock
102
- - gemfiles/rails42.gemfile
103
- - gemfiles/rails42.gemfile.lock
104
- - gemfiles/rails50.gemfile
105
- - gemfiles/rails50.gemfile.lock
102
+ - gemfiles/rails_v5.1.x.gemfile
103
+ - gemfiles/rails_v5.1.x.gemfile.lock
104
+ - gemfiles/rails_v5.2.x.gemfile
105
+ - gemfiles/rails_v5.2.x.gemfile.lock
106
+ - gemfiles/rails_v6.0.x.gemfile
107
+ - gemfiles/rails_v6.0.x.gemfile.lock
106
108
  - lib/minitest-spec-rails.rb
107
109
  - lib/minitest-spec-rails/dsl.rb
108
110
  - lib/minitest-spec-rails/init/action_controller.rb
@@ -112,6 +114,7 @@ files:
112
114
  - lib/minitest-spec-rails/init/active_job.rb
113
115
  - lib/minitest-spec-rails/init/active_support.rb
114
116
  - lib/minitest-spec-rails/init/mini_shoulda.rb
117
+ - lib/minitest-spec-rails/parallelize.rb
115
118
  - lib/minitest-spec-rails/railtie.rb
116
119
  - lib/minitest-spec-rails/version.rb
117
120
  - minitest-spec-rails.gemspec
@@ -122,6 +125,7 @@ files:
122
125
  - test/cases/active_job_test.rb
123
126
  - test/cases/active_support_test.rb
124
127
  - test/cases/mini_shoulda_test.rb
128
+ - test/dummy_app/app/assets/config/manifest.js
125
129
  - test/dummy_app/app/controllers/application_controller.rb
126
130
  - test/dummy_app/app/controllers/users_controller.rb
127
131
  - test/dummy_app/app/helpers/application_helper.rb
@@ -167,8 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
171
  - !ruby/object:Gem::Version
168
172
  version: '0'
169
173
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.4.5.1
174
+ rubygems_version: 3.1.4
172
175
  signing_key:
173
176
  specification_version: 4
174
177
  summary: Make Rails Use MiniTest::Spec!
@@ -180,6 +183,7 @@ test_files:
180
183
  - test/cases/active_job_test.rb
181
184
  - test/cases/active_support_test.rb
182
185
  - test/cases/mini_shoulda_test.rb
186
+ - test/dummy_app/app/assets/config/manifest.js
183
187
  - test/dummy_app/app/controllers/application_controller.rb
184
188
  - test/dummy_app/app/controllers/users_controller.rb
185
189
  - test/dummy_app/app/helpers/application_helper.rb