fast_rspec 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1b05996c57beb4f83fb4caf12d26f35a65fbf409c8d619d87ffce12bdde9ef80
4
+ data.tar.gz: 541f1dc10532f7281593d3999a9059ef97b49b736f1ae201b9d45cd132a3e474
5
+ SHA512:
6
+ metadata.gz: b26c6d68981a21b2fc4e96318d7002130e72428ae3c123a5eaf7177da03f73954139c128fe3b0d19cd438f4b5754a14bfaab757dd3abc084a05b3f593fe8b975
7
+ data.tar.gz: 24a7e0d5a058a289d960a058a77c8ead24b9899eea9e0255c68144635c2048e818f0c5a594abc23c2f7e7b09a264079449d3b11c94a8d4bc2b7cb6ce1ac9cdc3
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ - Project skeleton: gemspec, C ext + pure-Ruby twin stubs, docs/idea design set, docs/target compat specs, agent setup (.claude, .dz maintainer, CI OK gate, release-on-version-bump).
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 developerz.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # FastRspec
2
+
3
+ **One gem line. Your whole test stack. Every core.**
4
+
5
+ Drop-in replacement for RSpec **and** Minitest (including Rails' `ActiveSupport::TestCase`), rebuilt lean: same API, a fraction of the overhead. Runs in parallel on all cores by default, and ships with batteries included and auto-configured: factories, Faker, VCR, WebMock, database cleaning, shoulda, time helpers, Capybara and coverage. Works with Rails and with plain Ruby. Runs on CRuby, JRuby and TruffleRuby.
6
+
7
+ > **Status: design phase (2026-10).** Gem skeleton only, nothing is implemented yet. See [`docs/idea/`](docs/idea/00-seed.md).
8
+
9
+ ## Install
10
+
11
+ ```ruby
12
+ # Gemfile
13
+ group :development, :test do
14
+ gem 'fast_rspec'
15
+ end
16
+ ```
17
+
18
+ Then delete the gems it replaces:
19
+
20
+ ```diff
21
+ - gem 'rspec'
22
+ - gem 'rspec-rails'
23
+ - gem 'factory_bot_rails'
24
+ - gem 'faker'
25
+ - gem 'vcr'
26
+ - gem 'webmock'
27
+ - gem 'database_cleaner-active_record'
28
+ - gem 'simplecov'
29
+ - gem 'minitest-reporters'
30
+ + gem 'fast_rspec'
31
+ ```
32
+
33
+ ## Run
34
+
35
+ Your commands stay the same:
36
+
37
+ ```bash
38
+ bundle exec rspec # all cores
39
+ bin/rails test # all cores; `parallelize` is handled for you
40
+ bundle exec rake test # plain Ruby + Minitest
41
+ bundle exec fast_rspec # auto-detects RSpec / Minitest / both
42
+ ```
43
+
44
+ You don't need to change any spec, test, `spec_helper.rb`, `rails_helper.rb`, `test_helper.rb` or `test/support/**` file. If you already configured something yourself, your configuration wins.
45
+
46
+ ## What's included
47
+
48
+ โœ… = FastRspec's own lean implementation of the upstream API (zero runtime dependencies). ๐Ÿ”Œ = keep the upstream gem in your Gemfile; FastRspec auto-configures it.
49
+
50
+ | Battery | Same API as | Auto-configured |
51
+ |---|---|---|
52
+ | ๐Ÿงช RSpec โœ… | rspec-core, -expectations, -mocks, -rails | `.rspec` honoured, type inference on Rails |
53
+ | ๐Ÿงช Minitest โœ… | minitest 5 + 6, `ActiveSupport::TestCase` | `parallelize` routed to our pool |
54
+ | ๐Ÿญ Factories โœ… | factory_bot (+ rails) | definitions found, `create`/`build` included |
55
+ | ๐ŸŽฒ Fake data โœ… | faker | deterministic per `--seed`, unique reset per test |
56
+ | ๐Ÿ“ผ HTTP โœ… | vcr + webmock | cassettes in `spec/cassettes` or `test/cassettes`, real net blocked, localhost allowed |
57
+ | ๐Ÿงน DB โœ… | transactional tests + database_cleaner | per-worker DB, cloned from a template |
58
+ | ๐Ÿ” Matchers ๐Ÿ”Œ | shoulda-matchers / -context | integrated with the framework in use |
59
+ | โฑ๏ธ Time ๐Ÿ”Œ | ActiveSupport `TimeHelpers` | included everywhere |
60
+ | ๐ŸŒ System ๐Ÿ”Œ | capybara + cuprite | headless Chrome, unique port per worker |
61
+ | ๐Ÿ“Š Coverage โœ… | simplecov | merged across workers (`COVERAGE=1`) |
62
+ | ๐Ÿ” Auth / jobs ๐Ÿ”Œ | Devise, Sidekiq / Wurk, ActiveJob | test helpers, fake/inline modes, per-worker Redis DB |
63
+
64
+ Turn any of them off:
65
+
66
+ ```ruby
67
+ FastRspec.configure { |c| c.batteries.disable :vcr, :capybara }
68
+ ```
69
+
70
+ ## Parallelism
71
+
72
+ | Ruby | How it runs |
73
+ |---|---|
74
+ | CRuby | boots once, forks N workers (copy-on-write), work-stealing queue, C extension on hot paths |
75
+ | JRuby / TruffleRuby | a real parallel thread pool (no GVL), using the pure-Ruby implementation |
76
+
77
+ `N` is the number of cores by default. Use `FAST_RSPEC_WORKERS=4` to change it, or `-n 1` for a serial run. Each worker gets its own database, Redis DB, tmp dir and ports. When a test fails, you get a one-line command that reproduces it, including the seed and the worker's files.
78
+
79
+ ## Docs
80
+
81
+ - [`docs/idea/`](docs/idea/00-seed.md): design and roadmap
82
+ - [`AGENTS.md`](AGENTS.md): conventions for contributors and AI agents
83
+ - [`llms.txt`](llms.txt): one-file reference for coding agents (target contract; status per milestone)
84
+
85
+ ## License
86
+
87
+ MIT
data/exe/fast_rspec ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'fast_rspec'
5
+
6
+ abort "fast_rspec #{FastRspec::VERSION}: runner not implemented yet โ€” see docs/idea/03-runner.md"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Only CRuby gets the C fast path. Elsewhere write a no-op Makefile so
4
+ # `gem install` succeeds and FastRspec::PureRuby is used.
5
+ if RUBY_ENGINE == 'ruby'
6
+ require 'mkmf'
7
+ $CFLAGS << ' -O3 -std=c99 -Wall' # rubocop:disable Style/GlobalVars -- mkmf API
8
+ create_makefile('fast_rspec/fast_rspec')
9
+ else
10
+ File.write('Makefile', "all:\n\ttrue\ninstall:\n\ttrue\nclean:\n\ttrue\n")
11
+ end
@@ -0,0 +1,11 @@
1
+ #include <ruby.h>
2
+
3
+ /* FastRspec::Native โ€” measured hot paths only. Must match FastRspec::PureRuby byte for byte. */
4
+
5
+ static VALUE engine(VALUE self) { return rb_str_new_cstr("native"); }
6
+
7
+ void Init_fast_rspec(void) {
8
+ VALUE mFastRspec = rb_define_module("FastRspec");
9
+ VALUE mNative = rb_define_module_under(mFastRspec, "Native");
10
+ rb_define_module_function(mNative, "engine", engine, 0);
11
+ }
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FastRspec
4
+ # User-facing knobs. Defaults are the zero-config path; every field is optional.
5
+ class Configuration
6
+ attr_accessor :workers, :pool
7
+
8
+ def initialize
9
+ @workers = Integer(ENV.fetch('FAST_RSPEC_WORKERS', Etc.nprocessors))
10
+ @pool = (ENV['FAST_RSPEC_POOL'] || default_pool).to_sym
11
+ @disabled = []
12
+ end
13
+
14
+ def batteries = self
15
+
16
+ def disable(*names) = @disabled.concat(names.map(&:to_sym))
17
+
18
+ def disabled?(name) = @disabled.include?(name.to_sym)
19
+
20
+ private
21
+
22
+ # fork where it's cheap and real (CRuby); threads where there is no GVL.
23
+ def default_pool
24
+ RUBY_ENGINE == 'ruby' && Process.respond_to?(:fork) ? :fork : :thread
25
+ end
26
+ end
27
+ end
28
+
29
+ require 'etc'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FastRspec
4
+ # What the host app has. Pure queries, no side effects โ€” batteries decide what to do.
5
+ module Detect
6
+ module_function
7
+
8
+ def rails? = defined?(::Rails::Railtie) ? true : false
9
+ def active_record? = defined?(::ActiveRecord::Base) ? true : false
10
+ def rspec? = File.exist?('.rspec') || Dir.exist?('spec')
11
+ def minitest? = Dir.exist?('test')
12
+ def gem?(name) = Gem.loaded_specs.key?(name)
13
+ end
14
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FastRspec
4
+ # Rails integration entry point. Wires batteries after the app boots.
5
+ class Railtie < ::Rails::Railtie
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FastRspec
4
+ # Pure-Ruby twin of FastRspec::Native (JRuby, TruffleRuby, failed ext build).
5
+ module PureRuby
6
+ module_function
7
+
8
+ def engine = 'pure_ruby'
9
+ end
10
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FastRspec
4
+ # Picks the C fast path on CRuby, the pure-Ruby twin elsewhere.
5
+ # Both must produce byte-identical output (see test/unit/render_parity_test.rb).
6
+ module Render
7
+ begin
8
+ raise LoadError if ENV['FAST_RSPEC_DISABLE_EXT'] == '1' || RUBY_ENGINE != 'ruby'
9
+
10
+ require_relative 'fast_rspec'
11
+ IMPL = FastRspec::Native
12
+ rescue LoadError
13
+ require_relative 'render/pure_ruby'
14
+ IMPL = FastRspec::PureRuby
15
+ end
16
+
17
+ def self.native? = IMPL.name == 'FastRspec::Native'
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FastRspec
4
+ VERSION = '0.0.1'
5
+ end
data/lib/fast_rspec.rb ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'fast_rspec/version'
4
+
5
+ # One gem line replaces the whole test stack. See AGENTS.md and docs/idea/.
6
+ module FastRspec
7
+ class Error < StandardError; end
8
+
9
+ autoload :Configuration, 'fast_rspec/configuration'
10
+ autoload :Detect, 'fast_rspec/detect'
11
+ autoload :Render, 'fast_rspec/render'
12
+
13
+ class << self
14
+ def configuration
15
+ @configuration ||= Configuration.new
16
+ end
17
+
18
+ def configure
19
+ yield configuration
20
+ end
21
+ end
22
+ end
23
+
24
+ require_relative 'fast_rspec/rails/railtie' if defined?(Rails::Railtie)
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fast_rspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - developerz.ai
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: One gem line replaces rspec-rails, factory_bot, faker, vcr, webmock,
13
+ database_cleaner, shoulda, capybara and simplecov. Parallel on every core by default
14
+ (fork on CRuby, threads on JRuby/TruffleRuby). Works with Rails and plain Ruby.
15
+ email:
16
+ - admin@developerz.ai
17
+ executables:
18
+ - fast_rspec
19
+ extensions:
20
+ - ext/fast_rspec/extconf.rb
21
+ extra_rdoc_files: []
22
+ files:
23
+ - CHANGELOG.md
24
+ - LICENSE
25
+ - README.md
26
+ - exe/fast_rspec
27
+ - ext/fast_rspec/extconf.rb
28
+ - ext/fast_rspec/fast_rspec.c
29
+ - lib/fast_rspec.rb
30
+ - lib/fast_rspec/configuration.rb
31
+ - lib/fast_rspec/detect.rb
32
+ - lib/fast_rspec/rails/railtie.rb
33
+ - lib/fast_rspec/render.rb
34
+ - lib/fast_rspec/render/pure_ruby.rb
35
+ - lib/fast_rspec/version.rb
36
+ homepage: https://github.com/developerz-ai/fast_rspec
37
+ licenses:
38
+ - MIT
39
+ metadata:
40
+ source_code_uri: https://github.com/developerz-ai/fast_rspec
41
+ changelog_uri: https://github.com/developerz-ai/fast_rspec/blob/main/CHANGELOG.md
42
+ bug_tracker_uri: https://github.com/developerz-ai/fast_rspec/issues
43
+ rubygems_mfa_required: 'true'
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 3.2.0
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubygems_version: 3.6.9
59
+ specification_version: 4
60
+ summary: Lean drop-in RSpec + Minitest, parallel on every core, whole test stack bundled.
61
+ test_files: []