minispec-rails 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d99901e5cd8d396c7b26b6b5d9b0592a66ed091e
4
- data.tar.gz: cd4f2da6203d362fd2a24d0f15aa36a9e921126d
3
+ metadata.gz: f28f329c71a0112785204c37f8e24ba0f52047c5
4
+ data.tar.gz: c911b14e1d51c3f8fe9855f1ee29bf4b9c209e00
5
5
  SHA512:
6
- metadata.gz: 88d5fba22bf4642244cf78a50304d97985d963af902ed6c129bc429c32e12b8f8eafe856b24349d6d01c17830d034ff6480950a34d2e6565eea752a4c91e2f60
7
- data.tar.gz: e6158199d4ab0321e1f502a5808d0376588703129657de4c00958a4f3ab35c8076de6d267f8f2b579ca35df0a2a3332b4d4f3da9e462f580204aa5f0961072f0
6
+ metadata.gz: ce7a560b47a5b94064bf630d0f137449dce7c7e83e4433985002f962e84f2469bcb4fca15e22e3b9e4cdd5d7377a9f67f6f6b2d7aaee58094220cdf4b74ec56c
7
+ data.tar.gz: 8dd819bbf7ce173dde14bfdec6cbf837adee06ad7e79d7a8ac97110ea7aaf4611db5614a32b85b66d44addd283be1564392357ee150d3170ce644ed6386e7ce3
data/README.md CHANGED
@@ -52,6 +52,14 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
52
52
  end
53
53
  ```
54
54
 
55
+ ### Spec Types
56
+
57
+ * `describe` any AbstractController::Base subclass, the test will be a subclass of ActionDispatch::IntegrationTest.
58
+ * `describe` any ActiveJob::Base subclass, the test will be a subclass of ActiveJob::TestCase.
59
+ * `describe` any ActionMailer::Base subclass, the test will be a subclass of ActiveJob::TestCase.
60
+ * `describe` any String, the test will be a subclass of ActionDispatch::SystemTestCase.
61
+ * `describe` anything else, the test will be a subclass of ActiveSupport::TestCase.
62
+
55
63
  See the [example rails app](https://github.com/ordinaryzelig/minispec-rails-example).
56
64
 
57
65
  ## TODO
@@ -4,21 +4,31 @@ require 'minitest/spec'
4
4
  module Minispec
5
5
  module Rails
6
6
 
7
+ # Default test will be subclass of ActiveSupport::TestCase.
8
+ Minitest::Spec::TYPES.clear
9
+ Minitest::Spec.register_spec_type(//, ActiveSupport::TestCase)
10
+
7
11
  # We can't force ActiveSupport to be a subclass of Minitest::Spec.
8
12
  # Next best thing.
9
13
  ActiveSupport::TestCase.extend Minitest::Spec::DSL
10
14
 
11
- ActiveSupport.on_load(:active_support_test_case) do
12
- Minitest::Spec.register_spec_type(ActiveSupport::TestCase) do |desc|
13
- desc.is_a?(Class) && desc.include?(ActiveRecord::Core)
14
- end
15
- end
16
-
17
15
  ActiveSupport.on_load(:action_dispatch_integration_test) do
18
16
  Minitest::Spec.register_spec_type(ActionDispatch::IntegrationTest) do |desc|
19
17
  desc.is_a?(Class) && desc < AbstractController::Base
20
18
  end
21
19
  end
22
20
 
21
+ ActiveSupport.on_load(:active_job) do
22
+ Minitest::Spec.register_spec_type(ActiveJob::TestCase) do |desc|
23
+ desc.is_a?(Class) && desc < ActiveJob::Base
24
+ end
25
+ end
26
+
27
+ ActiveSupport.on_load(:action_mailer_test_case) do
28
+ Minitest::Spec.register_spec_type(ActionMailer::TestCase) do |desc|
29
+ desc.is_a?(Class) && desc < ActionMailer::Base
30
+ end
31
+ end
32
+
23
33
  end
24
34
  end
@@ -6,7 +6,9 @@ ActionDispatch::SystemTestCase.extend(
6
6
  def inherited(*)
7
7
  super
8
8
  unless Minitest::Spec::TYPES.find { |matcher, type| type == ApplicationSystemTestCase }
9
- Minitest::Spec.register_spec_type(//, ApplicationSystemTestCase)
9
+ Minitest::Spec.register_spec_type(ApplicationSystemTestCase) do |desc|
10
+ desc.is_a?(String)
11
+ end
10
12
  end
11
13
  end
12
14
  end
@@ -1,5 +1,5 @@
1
1
  module Minispec
2
2
  module Rails
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minispec-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Ning