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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f62860b3fe28a0311e4b7e9cdf01d5f5142f9bee4d1b2311f6f971208dc529f
4
- data.tar.gz: 06a711d20c62e0e09e79ab76004bcf29492213d12418f0d6f8f9e8651869927f
3
+ metadata.gz: ec0114a234eb6f716145dc4a1be37a9808ec44fbd16fca0ce19f970f95e168c8
4
+ data.tar.gz: bed776e88a668b82801858071acc2de0b0a4cc6942b9066b5aa297fd0d3fde64
5
5
  SHA512:
6
- metadata.gz: bcfb44aae8f51049eb5c18e3fb8f5aba70f1ff0075720be773a58245a80dd5b3b592936132e748534aac1a08554209508d0496f4b11762628eb4a5d72c802732
7
- data.tar.gz: cf0fd9d98dca61efb19a1676729e482a13afbceae1d72b375dbbd4d447f085be899bf5883656db72762e2d2bf7491af53e861d694f6afcfe95862f49e7cbcda6
6
+ metadata.gz: bfefb1090baf10b81ec5c0824d91974845965747362ab5e8251035cbe67b286d409b77df79559f564c99995cbff92f15224895b38c31bbaf78d2c311f9aab2ee
7
+ data.tar.gz: e2792341127375463b0c4116988b11240d5e1bd173cd76f2a6e65bb65e04a97d0b2f45c1f5b18a5cf8078ef34f98d59f44352c8e130a9bc4121140f83930da96
data/README.md CHANGED
@@ -1,34 +1,82 @@
1
1
  # Minitest::Trailblazer
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ Minitest base classes and assertion helpers for [Trailblazer](https://trailblazer.to) applications.
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/minitest/trailblazer`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
9
+ Add to your application's Gemfile (usually the `:development, :test` group):
10
10
 
11
- Install the gem and add to the application's Gemfile by executing:
11
+ ```ruby
12
+ gem "minitest-trailblazer"
13
+ ```
12
14
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
15
+ Or install directly:
14
16
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
17
+ ```console
18
+ gem install minitest-trailblazer
19
+ ```
16
20
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
21
+ Supports minitest 5.x and 6.x.
18
22
 
19
23
  ## Usage
20
24
 
21
- TODO: Write usage instructions here
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 `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
73
+ After checking out the repo, run `bundle install`, then `bundle exec rake test`.
26
74
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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 on GitHub at https://github.com/[USERNAME]/minitest-trailblazer.
79
+ Bug reports and pull requests are welcome at https://github.com/seuros/minitest-trailblazer.
32
80
 
33
81
  ## License
34
82
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minitest
4
4
  module Trailblazer
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  end
7
7
  end
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.1
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: 2024-01-10 00:00:00.000000000 Z
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: '6.0'
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: '6.0'
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: 3.2.33
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: []