packs-rails-minitest 0.1.1 → 0.1.3
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 +13 -3
- data/lib/packs/rails/minitest/version.rb +1 -1
- data/lib/tasks/packs/test.rake +19 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0af4760c8ebd6d083516a7f4be43c417f00e37e1eb7a764c01eec643e045883d
|
4
|
+
data.tar.gz: 9cb08376463bd7fe2a7756df2c693f1ddf94b9e972a429ec5c527e091b0cfb9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6988173415813cef847aa6b632f12f748bc91d7a0fdda83a02e9dcf92ea867294dd2621fccfd144140982b86c60caed3ef7eda6fcb3becbcd588b1a2092d8ba7
|
7
|
+
data.tar.gz: 92f984cf364fd9a33e21021d5028cff4108d585550f96d3b0f873eacef7c91a70f8ed69cd99229c8165b7730114ac658cc57e0dbb1b879c8a24a5ed7de80faed
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Packs::Rails::Minitest
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/packs-rails-minitest)
|
4
|
+
|
3
5
|
Adds Rake tasks for testing [packs](https://github.com/rubyatscale/packs) using minitest.
|
4
6
|
|
5
7
|
## Installation
|
@@ -40,13 +42,19 @@ The environment variables should be set to values returned by the following Ruby
|
|
40
42
|
|
41
43
|
| Variable | Ruby |
|
42
44
|
|----------------------|--------------------------------------------------------------------------------------|
|
43
|
-
| DEFAULT_TEST | `"{.,#{Packs.all.map(&:relative_path).join(",")}/test/**/*_test.rb
|
44
|
-
| DEFAULT_TEST_EXCLUDE | `"{.,#{Packs.all.map(&:relative_path).join(",")}/test/{system,dummy}/**/*_test.rb
|
45
|
+
| DEFAULT_TEST | `"{.,#{Packs.all.map(&:relative_path).join(",")}}/test/**/*_test.rb"` |
|
46
|
+
| DEFAULT_TEST_EXCLUDE | `"{.,#{Packs.all.map(&:relative_path).join(",")}}/test/{system,dummy}/**/*_test.rb"` |
|
45
47
|
|
46
48
|
How you set this up is up to you, there isn't really a standard place. In `application.rb` or `boot.rb` work, just make
|
47
49
|
sure you only set it if it is not already set, otherwise the Rake tasks defined in this package may not work.
|
48
50
|
|
49
|
-
|
51
|
+
You'll also need to make sure the prepare tasks are run as part of `test:prepare`, e.g.:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
Rake::Task["test:prepare"].enhance(["packs:test:prepare"])
|
55
|
+
```
|
56
|
+
|
57
|
+
#### Rake tasks
|
50
58
|
|
51
59
|
Appropriate Rake tasks will be defined for you by setting `config.packs_rails_minitest.override_tasks = true` in
|
52
60
|
your `application.rb`. If you only include this gem in specific environments you will need to set it conditionally e.g.
|
@@ -55,6 +63,8 @@ your `application.rb`. If you only include this gem in specific environments you
|
|
55
63
|
config.packs_rails_minitest.override_tasks = true if Rails.env.development? || Rails.env.test?
|
56
64
|
```
|
57
65
|
|
66
|
+
Remember that you must use `rake test` instead of `rails test` for this to work.
|
67
|
+
|
58
68
|
## Contributing
|
59
69
|
|
60
70
|
Contributions are welcome, simply create a pull request or file an issue.
|
data/lib/tasks/packs/test.rake
CHANGED
@@ -1,38 +1,36 @@
|
|
1
|
+
run_tests = ->(*args) { system("rails", "test", *args) || exit($?.exitstatus) }
|
2
|
+
|
1
3
|
namespace :packs do
|
4
|
+
|
2
5
|
task test: "test:prepare" do
|
3
6
|
ENV["DEFAULT_TEST"] = "{#{Packs.all.map(&:relative_path).join(",")}}/test/**/*_test.rb"
|
4
7
|
ENV["DEFAULT_TEST_EXCLUDE"] = "{#{Packs.all.map(&:relative_path).join(",")}}/test/{system,dummy}/**/*_test.rb"
|
5
|
-
|
8
|
+
run_tests.call
|
6
9
|
end
|
7
10
|
|
8
11
|
namespace :test do
|
9
12
|
multitask prepare: Packs.all.map { |pack| "#{pack.name}:prepare" }
|
10
13
|
|
11
14
|
task all: :prepare do
|
12
|
-
|
15
|
+
run_tests.call(*Packs.all.map { |pack| pack.relative_path.join("test/**/*_test.rb").to_s })
|
13
16
|
end
|
14
17
|
|
15
18
|
task system: :prepare do
|
16
|
-
|
19
|
+
run_tests.call(*Packs.all.map { |pack| pack.relative_path.join("test/system/**/*_test.rb").to_s })
|
17
20
|
end
|
18
21
|
|
19
22
|
Packs.all.each do |pack|
|
20
23
|
task pack.name => "#{pack.name}:prepare" do
|
21
24
|
ENV["DEFAULT_TEST"] = pack.relative_path.join("test/**/*_test.rb").to_s
|
22
25
|
ENV["DEFAULT_TEST_EXCLUDE"] = pack.relative_path.join("test/{system,dummy}/**/*_test.rb").to_s
|
23
|
-
|
26
|
+
run_tests.call
|
24
27
|
end
|
25
28
|
|
26
29
|
namespace pack.name do
|
27
30
|
multitask :prepare
|
28
31
|
|
29
|
-
task
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
task system: :prepare do
|
34
|
-
system("rails", "test", pack.relative_path.join("test/system/**/*_test.rb").to_s)
|
35
|
-
end
|
32
|
+
task(all: :prepare) { run_tests.call(pack.relative_path.join("test/**/*_test.rb").to_s) }
|
33
|
+
task(system: :prepare) { run_tests.call(pack.relative_path.join("test/system/**/*_test.rb").to_s) }
|
36
34
|
end
|
37
35
|
end
|
38
36
|
end
|
@@ -43,19 +41,23 @@ if Rails.configuration.packs_rails_minitest.override_tasks
|
|
43
41
|
Rake::Task["test:all"]&.clear
|
44
42
|
Rake::Task["test:system"]&.clear
|
45
43
|
|
46
|
-
multitask test: ["test:prepare", "packs:test:prepare"] do
|
44
|
+
multitask test: ["test:prepare", "packs:test:prepare"] do |_, args|
|
47
45
|
ENV["DEFAULT_TEST"] = "{.,#{Packs.all.map(&:relative_path).join(",")}}/test/**/*_test.rb"
|
48
46
|
ENV["DEFAULT_TEST_EXCLUDE"] = "{.,#{Packs.all.map(&:relative_path).join(",")}}/test/{system,dummy}/**/*_test.rb"
|
49
|
-
|
47
|
+
if ENV.key? "TEST"
|
48
|
+
run_tests.call(ENV["TEST"])
|
49
|
+
else
|
50
|
+
run_tests.call
|
51
|
+
end
|
50
52
|
end
|
51
53
|
|
52
54
|
namespace :test do
|
53
|
-
multitask all: [:prepare, "packs:test:prepare"] do
|
54
|
-
|
55
|
+
multitask all: [:prepare, "packs:test:prepare"] do |_, args|
|
56
|
+
run_tests.call("test/**/*_test.rb", *Packs.all.map { |pack| pack.relative_path.join("test/**/*_test.rb").to_s })
|
55
57
|
end
|
56
58
|
|
57
|
-
multitask system: [:prepare, "packs:test:prepare"] do
|
58
|
-
|
59
|
+
multitask system: [:prepare, "packs:test:prepare"] do |_, args|
|
60
|
+
run_tests.call("test/system/**/*_test.rb", *Packs.all.map { |pack| pack.relative_path.join("test/system/**/*_test.rb").to_s })
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packs-rails-minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Graham Rogers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: packs
|