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 +4 -4
- data/README.md +8 -0
- data/lib/minispec/rails.rb +16 -6
- data/lib/minispec/rails/system_test.rb +3 -1
- data/lib/minispec/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f28f329c71a0112785204c37f8e24ba0f52047c5
|
4
|
+
data.tar.gz: c911b14e1d51c3f8fe9855f1ee29bf4b9c209e00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/minispec/rails.rb
CHANGED
@@ -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(
|
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
|