minitest-rails 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/CHANGELOG.rdoc +9 -0
- data/Gemfile +1 -1
- data/Manifest.txt +8 -0
- data/Rakefile +1 -1
- data/gemfiles/4.2.gemfile +5 -0
- data/lib/generators/minitest/controller/templates/controller_spec.rb +1 -1
- data/lib/generators/minitest/helper/templates/helper_spec.rb +0 -2
- data/lib/generators/minitest/helper/templates/helper_test.rb +0 -2
- data/lib/generators/minitest/install/install_generator.rb +1 -6
- data/lib/generators/minitest/install/templates/test_helper.rb +2 -10
- data/lib/generators/minitest/job/job_generator.rb +19 -0
- data/lib/generators/minitest/job/templates/job_spec.rb +9 -0
- data/lib/generators/minitest/job/templates/job_test.rb +9 -0
- data/lib/generators/minitest/mailer/templates/mailer_spec.rb +4 -4
- data/lib/generators/minitest/model/templates/model_spec.rb +1 -1
- data/lib/generators/minitest/model/templates/model_test.rb +0 -2
- data/lib/generators/minitest/route/templates/route_spec.rb +5 -2
- data/lib/generators/minitest/route/templates/route_test.rb +4 -1
- data/lib/generators/minitest/scaffold/templates/controller_spec.rb +12 -14
- data/lib/generators/minitest/scaffold/templates/controller_test.rb +2 -3
- data/lib/minitest/rails.rb +16 -3
- data/lib/minitest/rails/assertions.rb +223 -1
- data/lib/minitest/rails/expectations.rb +205 -24
- data/lib/minitest/rails/version.rb +1 -1
- data/minitest-rails.gemspec +11 -12
- data/tasks/test.rake +9 -0
- data/test/generators/test_install_generator.rb +0 -6
- data/test/generators/test_job_generator.rb +45 -0
- data/test/helper.rb +12 -0
- data/test/rails/action_controller/test_expectations.rb +6 -5
- data/test/rails/active_job/test_assertions.rb +46 -0
- data/test/rails/active_job/test_expectations.rb +55 -0
- data/test/rails/active_job/test_spec_type.rb +49 -0
- data/test/rails/active_support/test_expectations.rb +4 -4
- metadata +14 -30
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
1
3
|
module Minitest::Rails::Expectations
|
2
4
|
|
3
5
|
##############################################################################
|
@@ -7,27 +9,27 @@ module Minitest::Rails::Expectations
|
|
7
9
|
##
|
8
10
|
# Checks the numeric difference between the return value of an expression as a result of what is evaluated.
|
9
11
|
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
12
|
+
# value { User.create password: "valid" }.must_change "User.count"
|
13
|
+
# value { 3.times do
|
14
|
+
# User.create password: "valid"
|
15
|
+
# end }.must_change "User.count", 3
|
14
16
|
#
|
15
17
|
# See also ActiveSupport::TestCase#assert_difference
|
16
18
|
#
|
17
19
|
# :method: must_change
|
18
20
|
# :args: expression, difference = 1, message = nil
|
19
|
-
infect_an_assertion :assert_difference, :must_change
|
21
|
+
infect_an_assertion :assert_difference, :must_change, :block
|
20
22
|
|
21
23
|
##
|
22
24
|
# Checks that the numeric result of evaluating an expression is not changed before and after invoking.
|
23
25
|
#
|
24
|
-
#
|
26
|
+
# value { User.new }.wont_change "User.count"
|
25
27
|
#
|
26
28
|
# See also ActiveSupport::TestCase#refute_difference
|
27
29
|
#
|
28
30
|
# :method: wont_change
|
29
31
|
# :args: expression, message = nil
|
30
|
-
infect_an_assertion :refute_difference, :wont_change
|
32
|
+
infect_an_assertion :refute_difference, :wont_change, :block
|
31
33
|
|
32
34
|
##############################################################################
|
33
35
|
# ActionController/ActionView/ActionDispatch Expectations
|
@@ -46,11 +48,11 @@ module Minitest::Rails::Expectations
|
|
46
48
|
#
|
47
49
|
# # expect that the response was a redirection
|
48
50
|
# must_respond_with :redirect
|
49
|
-
# response.must_respond_with :redirect
|
51
|
+
# value(response).must_respond_with :redirect
|
50
52
|
#
|
51
53
|
# # expect that the response code was status code 401 (unauthorized)
|
52
54
|
# must_respond_with 401
|
53
|
-
# response.must_respond_with 401
|
55
|
+
# value(response).must_respond_with 401
|
54
56
|
#
|
55
57
|
# See also ActionController::TestCase#assert_response
|
56
58
|
# See also ActionView::TestCase#assert_response
|
@@ -128,16 +130,16 @@ module Minitest::Rails::Expectations
|
|
128
130
|
# The +defaults+ parameter is unused.
|
129
131
|
#
|
130
132
|
# # Expects that the default action is generated for a route with no action
|
131
|
-
# {controller: "items", action: "index"}.must_route_from "/items"
|
133
|
+
# value({controller: "items", action: "index"}).must_route_from "/items"
|
132
134
|
#
|
133
135
|
# # Tests that the list action is properly routed
|
134
|
-
# {controller: "items", action: "list"}.must_route_to "/items/list"
|
136
|
+
# value({controller: "items", action: "list"}).must_route_to "/items/list"
|
135
137
|
#
|
136
138
|
# # Tests the generation of a route with a parameter
|
137
|
-
# { controller: "items", action: "list", id: "1" }.must_route_from "/items/list/1"
|
139
|
+
# value({ controller: "items", action: "list", id: "1" }).must_route_from "/items/list/1"
|
138
140
|
#
|
139
141
|
# # Expects that the generated route gives us our custom route
|
140
|
-
# { controller: 'scm', action: 'show_diff', revision: "12" }.must_route_from "changesets/12"
|
142
|
+
# value({ controller: 'scm', action: 'show_diff', revision: "12" }).must_route_from "changesets/12"
|
141
143
|
#
|
142
144
|
# See also ActionController::TestCase#assert_generates
|
143
145
|
# See also ActionView::TestCase#assert_generates
|
@@ -163,21 +165,21 @@ module Minitest::Rails::Expectations
|
|
163
165
|
# extras argument, appending the query string on the path directly will not work. For example:
|
164
166
|
#
|
165
167
|
# # Expect that a path of '/items/list/1?view=print' returns the correct options
|
166
|
-
# 'items/list/1'.must_route_from({controller: 'items', action: 'list', id: '1', view: 'print'}, { view: "print" })
|
168
|
+
# value('items/list/1').must_route_from({controller: 'items', action: 'list', id: '1', view: 'print'}, { view: "print" })
|
167
169
|
#
|
168
170
|
# The +message+ parameter allows you to pass in an error message that is displayed upon failure.
|
169
171
|
#
|
170
172
|
# # Check the default route (i.e., the index action)
|
171
|
-
# 'items'.must_route_from({controller: 'items', action: 'index'})
|
173
|
+
# value('items').must_route_from({controller: 'items', action: 'index'})
|
172
174
|
#
|
173
175
|
# # Test a specific action
|
174
|
-
# 'items/list'.must_route_from({controller: 'items', action: 'list'})
|
176
|
+
# value('items/list').must_route_from({controller: 'items', action: 'list'})
|
175
177
|
#
|
176
178
|
# # Test an action with a parameter
|
177
|
-
# 'items/destroy/1'.must_route_from({controller: 'items', action: 'destroy', id: '1'})
|
179
|
+
# value('items/destroy/1').must_route_from({controller: 'items', action: 'destroy', id: '1'})
|
178
180
|
#
|
179
181
|
# # Test a custom route
|
180
|
-
# 'view/item1'.must_route_from({controller: 'items', action: 'show', id: '1'})
|
182
|
+
# value('view/item1').must_route_from({controller: 'items', action: 'show', id: '1'})
|
181
183
|
#
|
182
184
|
# See also ActionController::TestCase#assert_recognizes
|
183
185
|
# See also ActionView::TestCase#assert_recognizes
|
@@ -196,19 +198,19 @@ module Minitest::Rails::Expectations
|
|
196
198
|
# +message+ parameter allows you to specify a custom error message to display upon failure.
|
197
199
|
#
|
198
200
|
# # Expect a basic route: a controller with the default action (index)
|
199
|
-
# { controller: 'home', action: 'index' }.must_route_for '/home'
|
201
|
+
# value({ controller: 'home', action: 'index' }).must_route_for '/home'
|
200
202
|
#
|
201
203
|
# # Test a route generated with a specific controller, action, and parameter (id)
|
202
|
-
# { controller: 'entries', action: 'show', id: 23 }.must_route_for '/entries/show/23'
|
204
|
+
# value({ controller: 'entries', action: 'show', id: 23 }).must_route_for '/entries/show/23'
|
203
205
|
#
|
204
206
|
# # Expect a basic route (controller + default action), with an error message if it fails
|
205
|
-
# { controller: 'store', action: 'index' }.must_route_for '/store'
|
207
|
+
# value({ controller: 'store', action: 'index' }).must_route_for '/store'
|
206
208
|
#
|
207
209
|
# # Tests a route, providing a defaults hash
|
208
|
-
# {id: "9", item: "square"}.must_route_for 'controller/action/9', {controller: "controller", action: "action"}, {}, {item: "square"}
|
210
|
+
# value({id: "9", item: "square"}).must_route_for 'controller/action/9', {controller: "controller", action: "action"}, {}, {item: "square"}
|
209
211
|
#
|
210
212
|
# # Tests a route with a HTTP method
|
211
|
-
# { controller: "product", action: "update", id: "321" }.must_route_for({ method: 'put', path: '/product/321' })
|
213
|
+
# value({ controller: "product", action: "update", id: "321" }).must_route_for({ method: 'put', path: '/product/321' })
|
212
214
|
#
|
213
215
|
# See also ActionController::TestCase#assert_routing
|
214
216
|
# See also ActionView::TestCase#assert_routing
|
@@ -381,7 +383,7 @@ module Minitest::Rails::Expectations
|
|
381
383
|
# Checks the numeric difference between the return value of an expression as a result of what is evaluated.
|
382
384
|
#
|
383
385
|
# apple_link = '<a href="http://www.example.com">Apples</a>'
|
384
|
-
# link_to("Apples", "http://www.example.com").must_dom_equal apple_link
|
386
|
+
# value(link_to("Apples", "http://www.example.com")).must_dom_equal apple_link
|
385
387
|
#
|
386
388
|
# See also ActionController::TestCase#assert_dom_equal
|
387
389
|
# See also ActionView::TestCase#assert_dom_equal
|
@@ -530,6 +532,182 @@ module Minitest::Rails::Expectations
|
|
530
532
|
#
|
531
533
|
# :method: wont_have_tag
|
532
534
|
# :call-seq: wont_have_tag(*opts)
|
535
|
+
|
536
|
+
if defined?(::ActiveJob)
|
537
|
+
##############################################################################
|
538
|
+
# ActiveJob Expectations
|
539
|
+
##############################################################################
|
540
|
+
|
541
|
+
##
|
542
|
+
# Expects that the number of enqueued jobs matches the given number.
|
543
|
+
#
|
544
|
+
# def test_jobs
|
545
|
+
# must_enqueue_jobs 0
|
546
|
+
# HelloJob.perform_later('david')
|
547
|
+
# must_enqueue_jobs 1
|
548
|
+
# HelloJob.perform_later('abdelkader')
|
549
|
+
# must_enqueue_jobs 2
|
550
|
+
# end
|
551
|
+
#
|
552
|
+
# If a block is passed, that block should cause the specified number of
|
553
|
+
# jobs to be enqueued.
|
554
|
+
#
|
555
|
+
# def test_jobs_again
|
556
|
+
# must_enqueue_jobs 1 do
|
557
|
+
# HelloJob.perform_later('cristian')
|
558
|
+
# end
|
559
|
+
#
|
560
|
+
# must_enqueue_jobs 2 do
|
561
|
+
# HelloJob.perform_later('aaron')
|
562
|
+
# HelloJob.perform_later('rafael')
|
563
|
+
# end
|
564
|
+
# end
|
565
|
+
#
|
566
|
+
# See also ActiveJob::TestCase#assert_enqueued_jobs
|
567
|
+
#
|
568
|
+
# :method: must_enqueue_jobs
|
569
|
+
# :call-seq: must_enqueue_jobs(number)
|
570
|
+
|
571
|
+
##
|
572
|
+
# Expects that no jobs have been enqueued.
|
573
|
+
#
|
574
|
+
# def test_jobs
|
575
|
+
# wont_enqueue_jobs
|
576
|
+
# HelloJob.perform_later('jeremy')
|
577
|
+
# must_enqueue_jobs 1
|
578
|
+
# end
|
579
|
+
#
|
580
|
+
# If a block is passed, that block should not cause any job to be enqueued.
|
581
|
+
#
|
582
|
+
# def test_jobs_again
|
583
|
+
# wont_enqueue_jobs do
|
584
|
+
# # No job should be enqueued from this block
|
585
|
+
# end
|
586
|
+
# end
|
587
|
+
#
|
588
|
+
# Note: This expectation is simply a shortcut for:
|
589
|
+
#
|
590
|
+
# must_enqueue_jobs 0, &block
|
591
|
+
#
|
592
|
+
# See also ActiveJob::TestCase#assert_no_enqueued_jobs
|
593
|
+
#
|
594
|
+
# :method: wont_enqueue_jobs
|
595
|
+
# :call-seq: wont_enqueue_jobs(number)
|
596
|
+
|
597
|
+
##
|
598
|
+
# Expects that the number of performed jobs matches the given number.
|
599
|
+
# If no block is passed, <tt>perform_enqueued_jobs</tt>d
|
600
|
+
# must be called around the job call.
|
601
|
+
#
|
602
|
+
# def test_jobs
|
603
|
+
# must_perform_jobs 0
|
604
|
+
#
|
605
|
+
# perform_enqueued_jobs do
|
606
|
+
# HelloJob.perform_later('xavier')
|
607
|
+
# end
|
608
|
+
# must_perform_jobs 1
|
609
|
+
#
|
610
|
+
# perform_enqueued_jobs do
|
611
|
+
# HelloJob.perform_later('yves')
|
612
|
+
# must_perform_jobs 2
|
613
|
+
# end
|
614
|
+
# end
|
615
|
+
#
|
616
|
+
# If a block is passed, that block should cause the specified number of
|
617
|
+
# jobs to be performed.
|
618
|
+
#
|
619
|
+
# def test_jobs_again
|
620
|
+
# must_perform_jobs 1 do
|
621
|
+
# HelloJob.perform_later('robin')
|
622
|
+
# end
|
623
|
+
#
|
624
|
+
# must_perform_jobs 2 do
|
625
|
+
# HelloJob.perform_later('carlos')
|
626
|
+
# HelloJob.perform_later('sean')
|
627
|
+
# end
|
628
|
+
# end
|
629
|
+
#
|
630
|
+
# See also ActiveJob::TestCase#assert_performed_jobs
|
631
|
+
#
|
632
|
+
# :method: must_perform_jobs
|
633
|
+
# :call-seq: must_perform_jobs(number)
|
634
|
+
|
635
|
+
##
|
636
|
+
# Expects that no jobs have been performed.
|
637
|
+
#
|
638
|
+
# def test_jobs
|
639
|
+
# wont_perform_jobs
|
640
|
+
#
|
641
|
+
# perform_enqueued_jobs do
|
642
|
+
# HelloJob.perform_later('matthew')
|
643
|
+
# must_perform_jobs 1
|
644
|
+
# end
|
645
|
+
# end
|
646
|
+
#
|
647
|
+
# If a block is passed, that block should not cause any job to be performed.
|
648
|
+
#
|
649
|
+
# def test_jobs_again
|
650
|
+
# wont_perform_jobs do
|
651
|
+
# # No job should be performed from this block
|
652
|
+
# end
|
653
|
+
# end
|
654
|
+
#
|
655
|
+
# Note: This assertion is simply a shortcut for:
|
656
|
+
#
|
657
|
+
# must_perform_jobs 0, &block
|
658
|
+
#
|
659
|
+
# See also ActiveJob::TestCase#assert_no_performed_jobs
|
660
|
+
#
|
661
|
+
# :method: wont_perform_jobs
|
662
|
+
# :call-seq: wont_perform_jobs(number)
|
663
|
+
|
664
|
+
##
|
665
|
+
# Expects that the job passed in the block has been enqueued with the given arguments.
|
666
|
+
#
|
667
|
+
# def test_must_enqueue_with
|
668
|
+
# must_enqueue_with(job: MyJob, args: [1,2,3], queue: 'low') do
|
669
|
+
# MyJob.perform_later(1,2,3)
|
670
|
+
# end
|
671
|
+
# end
|
672
|
+
#
|
673
|
+
# See also Minitest::Rails::Expectations#assert_enqueued_with
|
674
|
+
#
|
675
|
+
# :method: must_enqueue_with
|
676
|
+
# :call-seq: must_enqueue_with(args)
|
677
|
+
|
678
|
+
##
|
679
|
+
# Expects that the job passed in the block has been performed with the given arguments.
|
680
|
+
#
|
681
|
+
# def test_must_perform_with
|
682
|
+
# must_perform_with(job: MyJob, args: [1,2,3], queue: 'high') do
|
683
|
+
# MyJob.perform_later(1,2,3)
|
684
|
+
# end
|
685
|
+
# end
|
686
|
+
#
|
687
|
+
# See also Minitest::Rails::Expectations#assert_performed_with
|
688
|
+
#
|
689
|
+
# :method: must_perform_with
|
690
|
+
# :call-seq: must_perform_with(args)
|
691
|
+
|
692
|
+
|
693
|
+
# This exists as a module to allow easy mixing into classes
|
694
|
+
# other than ActiveJob::TestCase where you might want to do
|
695
|
+
# job testing e.g. in an Active Record model which triggers
|
696
|
+
# jobs in a callback.
|
697
|
+
module ActiveJob
|
698
|
+
extend ActiveSupport::Concern
|
699
|
+
include ::ActiveJob::TestHelper
|
700
|
+
|
701
|
+
included do
|
702
|
+
alias :must_enqueue_jobs :assert_enqueued_jobs
|
703
|
+
alias :must_perform_jobs :assert_performed_jobs
|
704
|
+
alias :wont_enqueue_jobs :assert_no_enqueued_jobs
|
705
|
+
alias :wont_perform_jobs :assert_no_performed_jobs
|
706
|
+
alias :must_enqueue_with :assert_enqueued_with
|
707
|
+
alias :must_perform_with :assert_performed_with
|
708
|
+
end
|
709
|
+
end
|
710
|
+
end
|
533
711
|
end
|
534
712
|
|
535
713
|
unless ENV["MT_NO_EXPECTATIONS"]
|
@@ -558,6 +736,9 @@ unless ENV["MT_NO_EXPECTATIONS"]
|
|
558
736
|
alias :must_select_email :assert_select_email
|
559
737
|
alias :must_select_encoded :assert_select_encoded
|
560
738
|
end
|
739
|
+
class ActiveJob::TestCase # :nodoc:
|
740
|
+
include Minitest::Rails::Expectations::ActiveJob
|
741
|
+
end if defined?(ActiveJob)
|
561
742
|
class ActionDispatch::IntegrationTest # :nodoc:
|
562
743
|
alias :must_respond_with :assert_response
|
563
744
|
alias :must_redirect_to :assert_redirected_to
|
data/minitest-rails.gemspec
CHANGED
@@ -1,46 +1,45 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: minitest-rails 2.
|
2
|
+
# stub: minitest-rails 2.2.0.20150529121029 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "minitest-rails"
|
6
|
-
s.version = "2.
|
6
|
+
s.version = "2.2.0.20150529121029"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Mike Moore"]
|
11
|
-
s.date = "
|
11
|
+
s.date = "2015-05-29"
|
12
12
|
s.description = "Adds Minitest as the default testing library in Rails"
|
13
13
|
s.email = ["mike@blowmage.com"]
|
14
14
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
|
15
|
-
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/4.1.gemfile", "lib/generators/.document", "lib/generators/minitest.rb", "lib/generators/minitest/controller/controller_generator.rb", "lib/generators/minitest/controller/templates/controller_spec.rb", "lib/generators/minitest/controller/templates/controller_test.rb", "lib/generators/minitest/generator/generator_generator.rb", "lib/generators/minitest/generator/templates/generator_spec.rb", "lib/generators/minitest/generator/templates/generator_test.rb", "lib/generators/minitest/helper/helper_generator.rb", "lib/generators/minitest/helper/templates/helper_spec.rb", "lib/generators/minitest/helper/templates/helper_test.rb", "lib/generators/minitest/install/install_generator.rb", "lib/generators/minitest/install/templates/test_helper.rb", "lib/generators/minitest/integration/integration_generator.rb", "lib/generators/minitest/integration/templates/integration_spec.rb", "lib/generators/minitest/integration/templates/integration_test.rb", "lib/generators/minitest/mailer/mailer_generator.rb", "lib/generators/minitest/mailer/templates/mailer_spec.rb", "lib/generators/minitest/mailer/templates/mailer_test.rb", "lib/generators/minitest/mailer/templates/preview.rb", "lib/generators/minitest/model/model_generator.rb", "lib/generators/minitest/model/templates/fixtures.yml", "lib/generators/minitest/model/templates/model_spec.rb", "lib/generators/minitest/model/templates/model_test.rb", "lib/generators/minitest/route/route_generator.rb", "lib/generators/minitest/route/templates/route_spec.rb", "lib/generators/minitest/route/templates/route_test.rb", "lib/generators/minitest/scaffold/scaffold_generator.rb", "lib/generators/minitest/scaffold/templates/controller_spec.rb", "lib/generators/minitest/scaffold/templates/controller_test.rb", "lib/minitest-rails.rb", "lib/minitest/rails.rb", "lib/minitest/rails/assertions.rb", "lib/minitest/rails/constant_lookup.rb", "lib/minitest/rails/expectations.rb", "lib/minitest/rails/railtie.rb", "lib/minitest/rails/version.rb", "minitest-rails.gemspec", "tasks/test.rake", "test/generators/test_controller_generator.rb", "test/generators/test_generator_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_route_generator.rb", "test/generators/test_scaffold_generator.rb", "test/helper.rb", "test/rails/action_controller/test_assertions.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_expectations.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_support/test_assertions.rb", "test/rails/active_support/test_expectations.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/generators/test_spec_type.rb", "test/rails/minitest_5_api_test.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb"]
|
15
|
+
s.files = [".autotest", ".gemtest", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "gemfiles/4.1.gemfile", "gemfiles/4.2.gemfile", "lib/generators/.document", "lib/generators/minitest.rb", "lib/generators/minitest/controller/controller_generator.rb", "lib/generators/minitest/controller/templates/controller_spec.rb", "lib/generators/minitest/controller/templates/controller_test.rb", "lib/generators/minitest/generator/generator_generator.rb", "lib/generators/minitest/generator/templates/generator_spec.rb", "lib/generators/minitest/generator/templates/generator_test.rb", "lib/generators/minitest/helper/helper_generator.rb", "lib/generators/minitest/helper/templates/helper_spec.rb", "lib/generators/minitest/helper/templates/helper_test.rb", "lib/generators/minitest/install/install_generator.rb", "lib/generators/minitest/install/templates/test_helper.rb", "lib/generators/minitest/integration/integration_generator.rb", "lib/generators/minitest/integration/templates/integration_spec.rb", "lib/generators/minitest/integration/templates/integration_test.rb", "lib/generators/minitest/job/job_generator.rb", "lib/generators/minitest/job/templates/job_spec.rb", "lib/generators/minitest/job/templates/job_test.rb", "lib/generators/minitest/mailer/mailer_generator.rb", "lib/generators/minitest/mailer/templates/mailer_spec.rb", "lib/generators/minitest/mailer/templates/mailer_test.rb", "lib/generators/minitest/mailer/templates/preview.rb", "lib/generators/minitest/model/model_generator.rb", "lib/generators/minitest/model/templates/fixtures.yml", "lib/generators/minitest/model/templates/model_spec.rb", "lib/generators/minitest/model/templates/model_test.rb", "lib/generators/minitest/route/route_generator.rb", "lib/generators/minitest/route/templates/route_spec.rb", "lib/generators/minitest/route/templates/route_test.rb", "lib/generators/minitest/scaffold/scaffold_generator.rb", "lib/generators/minitest/scaffold/templates/controller_spec.rb", "lib/generators/minitest/scaffold/templates/controller_test.rb", "lib/minitest-rails.rb", "lib/minitest/rails.rb", "lib/minitest/rails/assertions.rb", "lib/minitest/rails/constant_lookup.rb", "lib/minitest/rails/expectations.rb", "lib/minitest/rails/railtie.rb", "lib/minitest/rails/version.rb", "minitest-rails.gemspec", "tasks/test.rake", "test/generators/test_controller_generator.rb", "test/generators/test_generator_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_job_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_route_generator.rb", "test/generators/test_scaffold_generator.rb", "test/helper.rb", "test/rails/action_controller/test_assertions.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_expectations.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_job/test_assertions.rb", "test/rails/active_job/test_expectations.rb", "test/rails/active_job/test_spec_type.rb", "test/rails/active_support/test_assertions.rb", "test/rails/active_support/test_expectations.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/generators/test_spec_type.rb", "test/rails/minitest_5_api_test.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb"]
|
16
16
|
s.homepage = "http://blowmage.com/minitest-rails"
|
17
17
|
s.licenses = ["MIT"]
|
18
18
|
s.rdoc_options = ["--main", "README.rdoc"]
|
19
|
-
s.rubygems_version = "2.
|
19
|
+
s.rubygems_version = "2.4.6"
|
20
20
|
s.summary = "Minitest integration for Rails"
|
21
|
-
s.test_files = ["test/generators/test_controller_generator.rb", "test/generators/test_generator_generator.rb", "test/generators/test_helper_generator.rb", "test/generators/test_install_generator.rb", "test/generators/test_mailer_generator.rb", "test/generators/test_model_generator.rb", "test/generators/test_route_generator.rb", "test/generators/test_scaffold_generator.rb", "test/rails/action_controller/test_assertions.rb", "test/rails/action_controller/test_controllers.rb", "test/rails/action_controller/test_expectations.rb", "test/rails/action_controller/test_spec_type.rb", "test/rails/action_dispatch/test_spec_type.rb", "test/rails/action_mailer/test_mailers.rb", "test/rails/action_mailer/test_spec_type.rb", "test/rails/action_view/test_helpers.rb", "test/rails/action_view/test_spec_type.rb", "test/rails/active_support/test_assertions.rb", "test/rails/active_support/test_expectations.rb", "test/rails/active_support/test_spec_type.rb", "test/rails/generators/test_spec_type.rb", "test/rails/test_constant_lookup.rb", "test/test_sanity.rb", "test/rails/minitest_5_api_test.rb"]
|
22
21
|
|
23
22
|
if s.respond_to? :specification_version then
|
24
23
|
s.specification_version = 4
|
25
24
|
|
26
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
|
-
s.add_runtime_dependency(%q<minitest>, ["~> 5.
|
26
|
+
s.add_runtime_dependency(%q<minitest>, ["~> 5.7"])
|
28
27
|
s.add_runtime_dependency(%q<railties>, ["~> 4.1"])
|
29
28
|
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
|
30
29
|
s.add_development_dependency(%q<fakefs>, ["= 0.4.3"])
|
31
|
-
s.add_development_dependency(%q<hoe>, ["~> 3.
|
30
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.13"])
|
32
31
|
else
|
33
|
-
s.add_dependency(%q<minitest>, ["~> 5.
|
32
|
+
s.add_dependency(%q<minitest>, ["~> 5.7"])
|
34
33
|
s.add_dependency(%q<railties>, ["~> 4.1"])
|
35
34
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
36
35
|
s.add_dependency(%q<fakefs>, ["= 0.4.3"])
|
37
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
36
|
+
s.add_dependency(%q<hoe>, ["~> 3.13"])
|
38
37
|
end
|
39
38
|
else
|
40
|
-
s.add_dependency(%q<minitest>, ["~> 5.
|
39
|
+
s.add_dependency(%q<minitest>, ["~> 5.7"])
|
41
40
|
s.add_dependency(%q<railties>, ["~> 4.1"])
|
42
41
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
43
42
|
s.add_dependency(%q<fakefs>, ["= 0.4.3"])
|
44
|
-
s.add_dependency(%q<hoe>, ["~> 3.
|
43
|
+
s.add_dependency(%q<hoe>, ["~> 3.13"])
|
45
44
|
end
|
46
45
|
end
|
data/tasks/test.rake
CHANGED
@@ -7,8 +7,17 @@ namespace :test do
|
|
7
7
|
sh "rm -f Gemfile.lock"
|
8
8
|
end
|
9
9
|
|
10
|
+
desc "Run tests for Rails 4.2"
|
11
|
+
task "4.2" do
|
12
|
+
sh "rm -f Gemfile.lock"
|
13
|
+
ENV["RAILS_VERSION"] = "4.2"
|
14
|
+
sh "bundle && bundle exec rake test"
|
15
|
+
sh "rm -f Gemfile.lock"
|
16
|
+
end
|
17
|
+
|
10
18
|
desc "Run tests for all Rails versions"
|
11
19
|
task "all" do
|
12
20
|
sh "rake test:4.1"
|
21
|
+
sh "rake test:4.2"
|
13
22
|
end
|
14
23
|
end
|
@@ -12,11 +12,6 @@ class TestInstallGenerator < GeneratorTest
|
|
12
12
|
assert_match(/require "rails\/test_help"/m, contents)
|
13
13
|
assert_match(/require "minitest\/rails"/m, contents)
|
14
14
|
assert_match(/fixtures :all/m, contents)
|
15
|
-
if Rails::VERSION::STRING >= "4.0"
|
16
|
-
assert_match(/ActiveRecord::Migration.check_pending\!/m, contents)
|
17
|
-
else
|
18
|
-
refute_match(/ActiveRecord::Migration.check_pending\!/m, contents)
|
19
|
-
end
|
20
15
|
end
|
21
16
|
|
22
17
|
def test_install_generator_without_active_record
|
@@ -28,6 +23,5 @@ class TestInstallGenerator < GeneratorTest
|
|
28
23
|
assert_match(/require "rails\/test_help"/m, contents)
|
29
24
|
assert_match(/require "minitest\/rails"/m, contents)
|
30
25
|
refute_match(/fixtures :all/m, contents)
|
31
|
-
refute_match(/ActiveRecord::Migration.check_pending\!/m, contents)
|
32
26
|
end
|
33
27
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require "helper"
|
2
|
+
|
3
|
+
if defined? ActiveJob # Rails 4.2 and later.
|
4
|
+
require "generators/minitest/job/job_generator"
|
5
|
+
|
6
|
+
class TestJobGenerator < GeneratorTest
|
7
|
+
|
8
|
+
def test_job_generator
|
9
|
+
assert_output(/create test\/jobs\/user_invite_job_test.rb/m) do
|
10
|
+
Minitest::Generators::JobGenerator.start ["user_invite"]
|
11
|
+
end
|
12
|
+
assert File.exists? "test/jobs/user_invite_job_test.rb"
|
13
|
+
contents = File.read "test/jobs/user_invite_job_test.rb"
|
14
|
+
assert_match(/class UserInviteJobTest < ActiveJob::TestCase/m, contents)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_namespaced_job_generator
|
18
|
+
assert_output(/create test\/jobs\/admin\/user_invite_job_test.rb/m) do
|
19
|
+
Minitest::Generators::JobGenerator.start ["admin/user_invite"]
|
20
|
+
end
|
21
|
+
assert File.exists? "test/jobs/admin/user_invite_job_test.rb"
|
22
|
+
contents = File.read "test/jobs/admin/user_invite_job_test.rb"
|
23
|
+
assert_match(/class Admin::UserInviteJobTest < ActiveJob::TestCase/m, contents)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_job_generator_spec
|
27
|
+
assert_output(/create test\/jobs\/user_invite_job_test.rb/m) do
|
28
|
+
Minitest::Generators::JobGenerator.start ["user_invite", "--spec"]
|
29
|
+
end
|
30
|
+
assert File.exists? "test/jobs/user_invite_job_test.rb"
|
31
|
+
contents = File.read "test/jobs/user_invite_job_test.rb"
|
32
|
+
assert_match(/describe UserInviteJob do/m, contents)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_namespaced_job_generator_spec
|
36
|
+
assert_output(/create test\/jobs\/admin\/user_invite_job_test.rb/m) do
|
37
|
+
Minitest::Generators::JobGenerator.start ["admin/user_invite", "--spec"]
|
38
|
+
end
|
39
|
+
assert File.exists? "test/jobs/admin/user_invite_job_test.rb"
|
40
|
+
contents = File.read "test/jobs/admin/user_invite_job_test.rb"
|
41
|
+
assert_match(/describe Admin::UserInviteJob do/m, contents)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|