minitest-trailblazer 0.0.1 → 0.0.2
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 +59 -11
- data/lib/minitest/trailblazer/version.rb +1 -1
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec0114a234eb6f716145dc4a1be37a9808ec44fbd16fca0ce19f970f95e168c8
|
|
4
|
+
data.tar.gz: bed776e88a668b82801858071acc2de0b0a4cc6942b9066b5aa297fd0d3fde64
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bfefb1090baf10b81ec5c0824d91974845965747362ab5e8251035cbe67b286d409b77df79559f564c99995cbff92f15224895b38c31bbaf78d2c311f9aab2ee
|
|
7
|
+
data.tar.gz: e2792341127375463b0c4116988b11240d5e1bd173cd76f2a6e65bb65e04a97d0b2f45c1f5b18a5cf8078ef34f98d59f44352c8e130a9bc4121140f83930da96
|
data/README.md
CHANGED
|
@@ -1,34 +1,82 @@
|
|
|
1
1
|
# Minitest::Trailblazer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Minitest base classes and assertion helpers for [Trailblazer](https://trailblazer.to) applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Trailblazer's own testing conventions (see [trailblazer-test](https://github.com/trailblazer/trailblazer-test)) write assertions *actual-first* — `assert_equal result[:model].title, "Roxanne"` — while stock Minitest expects *expected-first*. Mixing the two styles in one suite is a reliable source of confusing failure diffs. This gem gives you dedicated base classes to build your operation tests on, and an opt-in override that makes `assert_equal` read actual-first everywhere you choose to use it.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Add to your application's Gemfile (usually the `:development, :test` group):
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
```ruby
|
|
12
|
+
gem "minitest-trailblazer"
|
|
13
|
+
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Or install directly:
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
```console
|
|
18
|
+
gem install minitest-trailblazer
|
|
19
|
+
```
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
Supports minitest 5.x and 6.x.
|
|
18
22
|
|
|
19
23
|
## Usage
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
### Base classes
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
require "minitest-trailblazer"
|
|
29
|
+
|
|
30
|
+
class Song::Operation::CreateTest < Minitest::TrailblazerTest
|
|
31
|
+
def test_valid_input
|
|
32
|
+
result = Song::Operation::Create.(params: { title: "Roxanne" })
|
|
33
|
+
|
|
34
|
+
assert result.success?
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Spec-style is available too:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
class Song::Operation::CreateSpec < Minitest::TrailblazerSpec
|
|
43
|
+
it "persists the model" do
|
|
44
|
+
result = Song::Operation::Create.(params: { title: "Roxanne" })
|
|
45
|
+
|
|
46
|
+
_(result[:model]).must_be :persisted?
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Both classes include `Minitest::Trailblazer::Assertions`, the extension point where Trailblazer-specific assertions land.
|
|
52
|
+
|
|
53
|
+
### Actual-first `assert_equal`
|
|
54
|
+
|
|
55
|
+
`Minitest::Trailblazer::AssertionsOverride` flips `assert_equal`'s argument order to `(actual, expected)`:
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
class Song::Operation::CreateTest < Minitest::TrailblazerTest
|
|
59
|
+
include Minitest::Trailblazer::AssertionsOverride
|
|
60
|
+
|
|
61
|
+
def test_title
|
|
62
|
+
result = Song::Operation::Create.(params: { title: "Roxanne" })
|
|
63
|
+
|
|
64
|
+
assert_equal result[:model].title, "Roxanne" # actual first, Trailblazer-style
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
It is deliberately opt-in per test class: include it where your suite follows Trailblazer conventions, leave the rest of your tests untouched.
|
|
22
70
|
|
|
23
71
|
## Development
|
|
24
72
|
|
|
25
|
-
After checking out the repo, run `
|
|
73
|
+
After checking out the repo, run `bundle install`, then `bundle exec rake test`.
|
|
26
74
|
|
|
27
|
-
|
|
75
|
+
Releases are cut by [release-please](https://github.com/googleapis/release-please) from conventional commit messages (`fix:`, `feat:`) on `master`.
|
|
28
76
|
|
|
29
77
|
## Contributing
|
|
30
78
|
|
|
31
|
-
Bug reports and pull requests are welcome
|
|
79
|
+
Bug reports and pull requests are welcome at https://github.com/seuros/minitest-trailblazer.
|
|
32
80
|
|
|
33
81
|
## License
|
|
34
82
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: minitest-trailblazer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abdelkader Boudih
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: minitest
|
|
@@ -19,7 +18,7 @@ dependencies:
|
|
|
19
18
|
version: '5.0'
|
|
20
19
|
- - "<"
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
21
|
+
version: '7'
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +28,7 @@ dependencies:
|
|
|
29
28
|
version: '5.0'
|
|
30
29
|
- - "<"
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
31
|
+
version: '7'
|
|
33
32
|
description: Minitest integration for Trailblazer
|
|
34
33
|
email:
|
|
35
34
|
- terminale@gmail.com
|
|
@@ -51,7 +50,6 @@ metadata:
|
|
|
51
50
|
source_code_uri: https://github.com/seuros/minitest-trailblazer
|
|
52
51
|
changelog_uri: https://github.com/seuros/minitest-trailblazer/blob/master/CHANGELOG.md
|
|
53
52
|
rubygems_mfa_required: 'true'
|
|
54
|
-
post_install_message:
|
|
55
53
|
rdoc_options: []
|
|
56
54
|
require_paths:
|
|
57
55
|
- lib
|
|
@@ -66,8 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
64
|
- !ruby/object:Gem::Version
|
|
67
65
|
version: '0'
|
|
68
66
|
requirements: []
|
|
69
|
-
rubygems_version:
|
|
70
|
-
signing_key:
|
|
67
|
+
rubygems_version: 4.0.10
|
|
71
68
|
specification_version: 4
|
|
72
69
|
summary: Minitest integration for Trailblazer
|
|
73
70
|
test_files: []
|