smartest 0.3.1.alpha5 → 0.3.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 +54 -15
- data/lib/smartest/init_browser_generator.rb +1 -1
- data/lib/smartest/version.rb +1 -1
- data/smartest/smartest_test.rb +5 -2
- data/smartest.gemspec +6 -5
- metadata +13 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1273e17fbc84bb22a5bf53b0176c5616ed8404e1ea6273720b6153f73c04b355
|
|
4
|
+
data.tar.gz: ddf2e93333e975b5d55ccd9a59125577cf2feaa415c7addcf1ebbc2c7bb25d43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 473ca3e954cb75238335dbd360c76d76c31076dbb0a17582480114ed49c7679c5326b47b6c175c9e52474b94b26c79b2774acbc62d35ec5885a6b2ac48b54107
|
|
7
|
+
data.tar.gz: 1b9541cccd90b5c70c2df6b99d723fb69a6ca3d965b989520f2b95b74c83ed0b066568e80d15621578f0aa7a5c025ada6c7f10ffc82b0311452191afd8dabf30
|
data/README.md
CHANGED
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
# Smartest
|
|
1
|
+
# Smartest introduces Pytest-style fixtures for Ruby
|
|
2
2
|
|
|
3
|
-
Smartest is a small Ruby test runner
|
|
3
|
+
Smartest is a small Ruby test runner that brings pytest-style fixture
|
|
4
|
+
injection, explicit fixture dependencies, and fixture cleanup to Ruby tests.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Tests request fixtures with Ruby keyword arguments. Fixtures define their own
|
|
7
|
+
dependencies the same way:
|
|
6
8
|
|
|
7
9
|
```ruby
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
class WebFixture < Smartest::Fixture
|
|
11
|
+
fixture :server do
|
|
12
|
+
server = TestServer.start
|
|
13
|
+
cleanup { server.stop }
|
|
14
|
+
server
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
fixture :client do |server:|
|
|
18
|
+
Client.new(base_url: server.url)
|
|
19
|
+
end
|
|
10
20
|
end
|
|
11
|
-
```
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
around_suite do |suite|
|
|
23
|
+
use_fixture WebFixture
|
|
24
|
+
suite.run
|
|
25
|
+
end
|
|
14
26
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
response = logged_in_client.get("/me")
|
|
27
|
+
test("GET /health") do |client:|
|
|
28
|
+
response = client.get("/health")
|
|
18
29
|
|
|
19
30
|
expect(response.status).to eq(200)
|
|
20
31
|
end
|
|
@@ -26,6 +37,32 @@ Smartest is designed around three ideas:
|
|
|
26
37
|
2. Fixture dependencies should be explicit.
|
|
27
38
|
3. Teardown should be written only when it is needed.
|
|
28
39
|
|
|
40
|
+
## Why Smartest?
|
|
41
|
+
|
|
42
|
+
Ruby already has excellent testing tools, but Smartest focuses on a specific
|
|
43
|
+
idea: tests should explicitly declare their dependencies.
|
|
44
|
+
|
|
45
|
+
RSpec `let` is useful when examples need lazy helper methods. Minitest `setup`
|
|
46
|
+
is simple for xUnit-style setup. Rails fixtures and FactoryBot are great for
|
|
47
|
+
test data. Smartest is aimed at tests where setup resources, dependency graphs,
|
|
48
|
+
and cleanup should be visible in the test signature and fixture definitions.
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
test("GET /me") do |logged_in_client:|
|
|
52
|
+
response = logged_in_client.get("/me")
|
|
53
|
+
|
|
54
|
+
expect(response.status).to eq(200)
|
|
55
|
+
end
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
| Tool | Style | Difference from Smartest |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| RSpec `let` | Lazy helper method | Tests pull dependencies from inside the example. |
|
|
61
|
+
| Minitest `setup` | xUnit setup method | Dependencies often become implicit instance state. |
|
|
62
|
+
| Rails fixtures | Database records | Not resource setup or fixture dependency injection. |
|
|
63
|
+
| FactoryBot | Test data factories | Not fixture lifecycle management. |
|
|
64
|
+
| Smartest | Keyword fixture injection | Tests declare dependencies explicitly. |
|
|
65
|
+
|
|
29
66
|
## Installation
|
|
30
67
|
|
|
31
68
|
Add this line to your application's Gemfile:
|
|
@@ -776,22 +813,24 @@ end
|
|
|
776
813
|
|
|
777
814
|
The dependency declaration and usage are in one place.
|
|
778
815
|
|
|
779
|
-
##
|
|
816
|
+
## Current scope
|
|
780
817
|
|
|
781
|
-
Smartest
|
|
782
|
-
|
|
783
|
-
The intended MVP includes:
|
|
818
|
+
Smartest currently focuses on a small runner API:
|
|
784
819
|
|
|
785
820
|
- top-level `test`
|
|
786
821
|
- class-based fixtures
|
|
787
822
|
- keyword-argument fixture injection
|
|
788
823
|
- fixture dependencies through keyword arguments
|
|
789
824
|
- fixture cleanup
|
|
825
|
+
- suite-scoped fixtures through `suite_fixture`
|
|
790
826
|
- suite hooks with `around_suite`
|
|
791
827
|
- test hooks with `around_test`
|
|
792
828
|
- skipped and pending tests through `skip` and `pending`
|
|
793
|
-
- `expect
|
|
829
|
+
- expectation matchers through `expect`
|
|
794
830
|
- console reporter
|
|
795
831
|
- CLI runner
|
|
796
832
|
- circular fixture dependency detection
|
|
797
833
|
- duplicate fixture detection
|
|
834
|
+
|
|
835
|
+
Nested `describe` blocks, watch mode, parallel execution, and file-scoped
|
|
836
|
+
fixtures are not part of the current MVP.
|
|
@@ -70,7 +70,7 @@ module Smartest
|
|
|
70
70
|
|
|
71
71
|
page.locator("a[href='/gems/smartest']").click
|
|
72
72
|
expect(page).to have_url("https://rubygems.org/gems/smartest")
|
|
73
|
-
expect(page.locator("
|
|
73
|
+
expect(page.locator("h1")).to have_text("smartest")
|
|
74
74
|
end
|
|
75
75
|
RUBY
|
|
76
76
|
|
data/lib/smartest/version.rb
CHANGED
data/smartest/smartest_test.rb
CHANGED
|
@@ -2024,8 +2024,11 @@ test("cli browser init generator creates Playwright scaffold and installation co
|
|
|
2024
2024
|
status = generator.run
|
|
2025
2025
|
|
|
2026
2026
|
expect(status).to eq(0)
|
|
2027
|
-
|
|
2028
|
-
expect(
|
|
2027
|
+
example_browser_test = File.read(File.join(dir, "smartest/example_browser_test.rb"))
|
|
2028
|
+
expect(example_browser_test).to include("finds the smartest gem on RubyGems")
|
|
2029
|
+
expect(example_browser_test).to include('expect(page).to have_url("https://rubygems.org/gems/smartest")')
|
|
2030
|
+
expect(example_browser_test).to include('expect(page.locator("h1")).to have_text("smartest")')
|
|
2031
|
+
expect(example_browser_test).not_to include("0.3.0.alpha1")
|
|
2029
2032
|
expect(File.read(File.join(dir, "smartest/fixtures/playwright_fixture.rb"))).to include("class PlaywrightFixture < Smartest::Fixture")
|
|
2030
2033
|
expect(File.read(File.join(dir, "smartest/fixtures/playwright_fixture.rb"))).to include('require "playwright"')
|
|
2031
2034
|
expect(File.read(File.join(dir, "smartest/fixtures/playwright_fixture.rb"))).to include('playwright_cli_executable_path: "./node_modules/.bin/playwright"')
|
data/smartest.gemspec
CHANGED
|
@@ -7,19 +7,20 @@ Gem::Specification.new do |spec|
|
|
|
7
7
|
spec.version = Smartest::VERSION
|
|
8
8
|
spec.authors = ["Yusuke Iwaki"]
|
|
9
9
|
|
|
10
|
-
spec.summary = "
|
|
11
|
-
spec.description = "Smartest is a
|
|
12
|
-
spec.homepage = "https://
|
|
10
|
+
spec.summary = "Pytest-style fixtures for Ruby."
|
|
11
|
+
spec.description = "Smartest is a Ruby test runner with pytest-style fixture injection. Tests request fixtures using keyword arguments, fixtures can depend on other fixtures, and cleanup is registered only when needed."
|
|
12
|
+
spec.homepage = "https://smartest-rb.vercel.app"
|
|
13
13
|
spec.license = "MIT"
|
|
14
14
|
spec.required_ruby_version = ">= 3.1"
|
|
15
15
|
|
|
16
16
|
spec.metadata = {
|
|
17
17
|
"allowed_push_host" => "https://rubygems.org",
|
|
18
18
|
"bug_tracker_uri" => "https://github.com/YusukeIwaki/smartest/issues",
|
|
19
|
-
"
|
|
19
|
+
"changelog_uri" => "https://github.com/YusukeIwaki/smartest/blob/main/CHANGELOG.md",
|
|
20
|
+
"documentation_uri" => "https://smartest-rb.vercel.app/docs/fixtures",
|
|
20
21
|
"homepage_uri" => spec.homepage,
|
|
21
22
|
"rubygems_mfa_required" => "true",
|
|
22
|
-
"source_code_uri" => "https://github.com/YusukeIwaki/smartest
|
|
23
|
+
"source_code_uri" => "https://github.com/YusukeIwaki/smartest"
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
spec.files = Dir.chdir(__dir__) do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: smartest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yusuke Iwaki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
@@ -24,8 +24,9 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '13.0'
|
|
27
|
-
description: Smartest is a
|
|
28
|
-
|
|
27
|
+
description: Smartest is a Ruby test runner with pytest-style fixture injection. Tests
|
|
28
|
+
request fixtures using keyword arguments, fixtures can depend on other fixtures,
|
|
29
|
+
and cleanup is registered only when needed.
|
|
29
30
|
email:
|
|
30
31
|
executables:
|
|
31
32
|
- smartest
|
|
@@ -71,16 +72,17 @@ files:
|
|
|
71
72
|
- lib/smartest/version.rb
|
|
72
73
|
- smartest.gemspec
|
|
73
74
|
- smartest/smartest_test.rb
|
|
74
|
-
homepage: https://
|
|
75
|
+
homepage: https://smartest-rb.vercel.app
|
|
75
76
|
licenses:
|
|
76
77
|
- MIT
|
|
77
78
|
metadata:
|
|
78
79
|
allowed_push_host: https://rubygems.org
|
|
79
80
|
bug_tracker_uri: https://github.com/YusukeIwaki/smartest/issues
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
changelog_uri: https://github.com/YusukeIwaki/smartest/blob/main/CHANGELOG.md
|
|
82
|
+
documentation_uri: https://smartest-rb.vercel.app/docs/fixtures
|
|
83
|
+
homepage_uri: https://smartest-rb.vercel.app
|
|
82
84
|
rubygems_mfa_required: 'true'
|
|
83
|
-
source_code_uri: https://github.com/YusukeIwaki/smartest
|
|
85
|
+
source_code_uri: https://github.com/YusukeIwaki/smartest
|
|
84
86
|
post_install_message:
|
|
85
87
|
rdoc_options: []
|
|
86
88
|
require_paths:
|
|
@@ -92,12 +94,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
92
94
|
version: '3.1'
|
|
93
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
96
|
requirements:
|
|
95
|
-
- - "
|
|
97
|
+
- - ">="
|
|
96
98
|
- !ruby/object:Gem::Version
|
|
97
|
-
version:
|
|
99
|
+
version: '0'
|
|
98
100
|
requirements: []
|
|
99
101
|
rubygems_version: 3.4.19
|
|
100
102
|
signing_key:
|
|
101
103
|
specification_version: 4
|
|
102
|
-
summary:
|
|
104
|
+
summary: Pytest-style fixtures for Ruby.
|
|
103
105
|
test_files: []
|