crspec 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/CHANGELOG.md +86 -0
- data/README.md +1 -1
- data/lib/crspec/cli.rb +86 -5
- data/lib/crspec/configuration.rb +62 -9
- data/lib/crspec/dsl.rb +66 -2
- data/lib/crspec/example.rb +60 -6
- data/lib/crspec/example_group.rb +363 -63
- data/lib/crspec/execution_context.rb +10 -6
- data/lib/crspec/expectations.rb +62 -2
- data/lib/crspec/file_fixtures.rb +18 -0
- data/lib/crspec/formatters/progress_formatter.rb +37 -14
- data/lib/crspec/matchers.rb +642 -0
- data/lib/crspec/mock/argument_matchers.rb +157 -0
- data/lib/crspec/mock/double.rb +246 -13
- data/lib/crspec/mock/interceptor.rb +32 -9
- data/lib/crspec/mock/space.rb +14 -0
- data/lib/crspec/process_runner.rb +332 -0
- data/lib/crspec/rails/assets_shim.rb +33 -0
- data/lib/crspec/rails/database_isolation.rb +179 -8
- data/lib/crspec/rails/parallel.rb +29 -29
- data/lib/crspec/rails/request_helpers.rb +70 -14
- data/lib/crspec/rails/system_server.rb +7 -0
- data/lib/crspec/rails/warden_shim.rb +18 -0
- data/lib/crspec/runner.rb +143 -29
- data/lib/crspec/shared_examples.rb +70 -0
- data/lib/crspec/status_persistence.rb +46 -0
- data/lib/crspec/transpiler/cli.rb +106 -15
- data/lib/crspec/transpiler/rewriter.rb +179 -25
- data/lib/crspec/version.rb +1 -1
- data/lib/crspec.rb +6 -0
- data/lib/rspec/core.rb +2 -0
- data/lib/rspec/expectations.rb +2 -0
- data/lib/rspec/mocks.rb +2 -0
- data/lib/rspec/rails.rb +2 -0
- data/lib/rspec.rb +2 -0
- metadata +27 -156
- data/benchmark/README.md +0 -56
- data/benchmark/run.rb +0 -72
- data/benchmark/spec/user_service_crspec_spec.rb +0 -15
- data/benchmark/spec/user_service_rspec_spec.rb +0 -16
- data/benchmark/target_service.rb +0 -12
- data/benchmark/test/user_service_test.rb +0 -18
- data/demo.rb +0 -129
- data/samples/book_store/.dockerignore +0 -51
- data/samples/book_store/.gitattributes +0 -9
- data/samples/book_store/.github/dependabot.yml +0 -12
- data/samples/book_store/.github/workflows/ci.yml +0 -130
- data/samples/book_store/.gitignore +0 -35
- data/samples/book_store/.kamal/hooks/docker-setup.sample +0 -3
- data/samples/book_store/.kamal/hooks/post-app-boot.sample +0 -3
- data/samples/book_store/.kamal/hooks/post-deploy.sample +0 -14
- data/samples/book_store/.kamal/hooks/post-proxy-reboot.sample +0 -3
- data/samples/book_store/.kamal/hooks/pre-app-boot.sample +0 -3
- data/samples/book_store/.kamal/hooks/pre-build.sample +0 -51
- data/samples/book_store/.kamal/hooks/pre-connect.sample +0 -47
- data/samples/book_store/.kamal/hooks/pre-deploy.sample +0 -122
- data/samples/book_store/.kamal/hooks/pre-proxy-reboot.sample +0 -3
- data/samples/book_store/.kamal/secrets +0 -20
- data/samples/book_store/.rubocop.yml +0 -8
- data/samples/book_store/.ruby-version +0 -1
- data/samples/book_store/Dockerfile +0 -77
- data/samples/book_store/Gemfile +0 -67
- data/samples/book_store/Gemfile.lock +0 -572
- data/samples/book_store/README.md +0 -24
- data/samples/book_store/Rakefile +0 -6
- data/samples/book_store/app/assets/images/.keep +0 -0
- data/samples/book_store/app/assets/stylesheets/application.css +0 -10
- data/samples/book_store/app/controllers/application_controller.rb +0 -2
- data/samples/book_store/app/controllers/books_controller.rb +0 -30
- data/samples/book_store/app/controllers/comments_controller.rb +0 -21
- data/samples/book_store/app/controllers/concerns/.keep +0 -0
- data/samples/book_store/app/controllers/users_controller.rb +0 -21
- data/samples/book_store/app/helpers/application_helper.rb +0 -2
- data/samples/book_store/app/helpers/books_helper.rb +0 -2
- data/samples/book_store/app/helpers/comments_helper.rb +0 -2
- data/samples/book_store/app/helpers/users_helper.rb +0 -2
- data/samples/book_store/app/javascript/application.js +0 -3
- data/samples/book_store/app/javascript/controllers/application.js +0 -9
- data/samples/book_store/app/javascript/controllers/hello_controller.js +0 -7
- data/samples/book_store/app/javascript/controllers/index.js +0 -4
- data/samples/book_store/app/jobs/application_job.rb +0 -7
- data/samples/book_store/app/mailers/application_mailer.rb +0 -4
- data/samples/book_store/app/models/application_record.rb +0 -3
- data/samples/book_store/app/models/book.rb +0 -10
- data/samples/book_store/app/models/comment.rb +0 -6
- data/samples/book_store/app/models/concerns/.keep +0 -0
- data/samples/book_store/app/models/user.rb +0 -4
- data/samples/book_store/app/views/layouts/application.html.erb +0 -29
- data/samples/book_store/app/views/layouts/mailer.html.erb +0 -13
- data/samples/book_store/app/views/layouts/mailer.text.erb +0 -1
- data/samples/book_store/app/views/pwa/manifest.json.erb +0 -22
- data/samples/book_store/app/views/pwa/service-worker.js +0 -26
- data/samples/book_store/bin/brakeman +0 -7
- data/samples/book_store/bin/bundler-audit +0 -6
- data/samples/book_store/bin/ci +0 -6
- data/samples/book_store/bin/dev +0 -2
- data/samples/book_store/bin/docker-entrypoint +0 -8
- data/samples/book_store/bin/importmap +0 -4
- data/samples/book_store/bin/jobs +0 -6
- data/samples/book_store/bin/kamal +0 -16
- data/samples/book_store/bin/rails +0 -4
- data/samples/book_store/bin/rake +0 -4
- data/samples/book_store/bin/rubocop +0 -8
- data/samples/book_store/bin/setup +0 -35
- data/samples/book_store/bin/thrust +0 -5
- data/samples/book_store/config/application.rb +0 -27
- data/samples/book_store/config/boot.rb +0 -4
- data/samples/book_store/config/bundler-audit.yml +0 -5
- data/samples/book_store/config/cable.yml +0 -17
- data/samples/book_store/config/cache.yml +0 -16
- data/samples/book_store/config/ci.rb +0 -24
- data/samples/book_store/config/credentials.yml.enc +0 -1
- data/samples/book_store/config/database.yml +0 -45
- data/samples/book_store/config/deploy.yml +0 -119
- data/samples/book_store/config/environment.rb +0 -5
- data/samples/book_store/config/environments/development.rb +0 -78
- data/samples/book_store/config/environments/production.rb +0 -90
- data/samples/book_store/config/environments/test.rb +0 -53
- data/samples/book_store/config/importmap.rb +0 -7
- data/samples/book_store/config/initializers/assets.rb +0 -7
- data/samples/book_store/config/initializers/content_security_policy.rb +0 -29
- data/samples/book_store/config/initializers/filter_parameter_logging.rb +0 -8
- data/samples/book_store/config/initializers/inflections.rb +0 -16
- data/samples/book_store/config/locales/en.yml +0 -31
- data/samples/book_store/config/puma.rb +0 -42
- data/samples/book_store/config/queue.yml +0 -18
- data/samples/book_store/config/recurring.yml +0 -15
- data/samples/book_store/config/routes.rb +0 -17
- data/samples/book_store/config/storage.yml +0 -27
- data/samples/book_store/config.ru +0 -6
- data/samples/book_store/db/cable_schema.rb +0 -11
- data/samples/book_store/db/cache_schema.rb +0 -12
- data/samples/book_store/db/migrate/20260731035441_create_users.rb +0 -10
- data/samples/book_store/db/migrate/20260731035506_create_books.rb +0 -11
- data/samples/book_store/db/migrate/20260731035528_create_comments.rb +0 -11
- data/samples/book_store/db/queue_schema.rb +0 -129
- data/samples/book_store/db/schema.rb +0 -39
- data/samples/book_store/db/seeds.rb +0 -9
- data/samples/book_store/lib/tasks/.keep +0 -0
- data/samples/book_store/log/.keep +0 -0
- data/samples/book_store/public/400.html +0 -135
- data/samples/book_store/public/404.html +0 -135
- data/samples/book_store/public/406-unsupported-browser.html +0 -135
- data/samples/book_store/public/422.html +0 -135
- data/samples/book_store/public/500.html +0 -135
- data/samples/book_store/public/icon.png +0 -0
- data/samples/book_store/public/icon.svg +0 -3
- data/samples/book_store/public/robots.txt +0 -1
- data/samples/book_store/script/.keep +0 -0
- data/samples/book_store/spec/models/book_spec.rb +0 -42
- data/samples/book_store/spec/models/comment_spec.rb +0 -22
- data/samples/book_store/spec/models/user_advanced_spec.rb +0 -27
- data/samples/book_store/spec/models/user_spec.rb +0 -30
- data/samples/book_store/spec/rails_helper.rb +0 -36
- data/samples/book_store/spec/rails_parallel_spec.rb +0 -23
- data/samples/book_store/spec/requests/books_spec.rb +0 -21
- data/samples/book_store/spec/requests/users_spec.rb +0 -14
- data/samples/book_store/spec/services/inventory_service_spec.rb +0 -28
- data/samples/book_store/spec/services/time_dependent_service_spec.rb +0 -26
- data/samples/book_store/spec/spec_helper.rb +0 -16
- data/samples/book_store/spec/system/book_store_system_spec.rb +0 -18
- data/samples/book_store/storage/.keep +0 -0
- data/samples/book_store/test/controllers/.keep +0 -0
- data/samples/book_store/test/controllers/books_controller_test.rb +0 -7
- data/samples/book_store/test/controllers/comments_controller_test.rb +0 -7
- data/samples/book_store/test/controllers/users_controller_test.rb +0 -7
- data/samples/book_store/test/fixtures/books.yml +0 -11
- data/samples/book_store/test/fixtures/comments.yml +0 -11
- data/samples/book_store/test/fixtures/files/.keep +0 -0
- data/samples/book_store/test/fixtures/users.yml +0 -9
- data/samples/book_store/test/helpers/.keep +0 -0
- data/samples/book_store/test/integration/.keep +0 -0
- data/samples/book_store/test/mailers/.keep +0 -0
- data/samples/book_store/test/models/.keep +0 -0
- data/samples/book_store/test/models/book_test.rb +0 -7
- data/samples/book_store/test/models/comment_test.rb +0 -7
- data/samples/book_store/test/models/user_test.rb +0 -7
- data/samples/book_store/test/test_helper.rb +0 -15
- data/samples/book_store/tmp/.keep +0 -0
- data/samples/book_store/tmp/pids/.keep +0 -0
- data/samples/book_store/tmp/storage/.keep +0 -0
- data/samples/book_store/vendor/.keep +0 -0
- data/samples/book_store/vendor/javascript/.keep +0 -0
- data/samples/user_spec.rb +0 -31
- data/test/crspec/configuration_test.rb +0 -76
- data/test/crspec/execution_context_test.rb +0 -61
- data/test/crspec/mock_test.rb +0 -55
- data/test/crspec/rails_test.rb +0 -62
- data/test/crspec/runner_test.rb +0 -68
- data/test/crspec/transpiler_test.rb +0 -41
- data/test/test_helper.rb +0 -6
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ruby-4.0.2
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# syntax=docker/dockerfile:1
|
|
2
|
-
# check=error=true
|
|
3
|
-
|
|
4
|
-
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
|
|
5
|
-
# docker build -t book_store .
|
|
6
|
-
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name book_store book_store
|
|
7
|
-
|
|
8
|
-
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
|
9
|
-
|
|
10
|
-
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
|
11
|
-
ARG RUBY_VERSION=4.0.2
|
|
12
|
-
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
|
13
|
-
|
|
14
|
-
# Rails app lives here
|
|
15
|
-
WORKDIR /rails
|
|
16
|
-
|
|
17
|
-
# Install base packages
|
|
18
|
-
RUN apt-get update -qq && \
|
|
19
|
-
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
|
|
20
|
-
ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
|
|
21
|
-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
22
|
-
|
|
23
|
-
# Set production environment variables and enable jemalloc for reduced memory usage and latency.
|
|
24
|
-
ENV RAILS_ENV="production" \
|
|
25
|
-
BUNDLE_DEPLOYMENT="1" \
|
|
26
|
-
BUNDLE_PATH="/usr/local/bundle" \
|
|
27
|
-
BUNDLE_WITHOUT="development" \
|
|
28
|
-
LD_PRELOAD="/usr/local/lib/libjemalloc.so"
|
|
29
|
-
|
|
30
|
-
# Throw-away build stage to reduce size of final image
|
|
31
|
-
FROM base AS build
|
|
32
|
-
|
|
33
|
-
# Install packages needed to build gems
|
|
34
|
-
RUN apt-get update -qq && \
|
|
35
|
-
apt-get install --no-install-recommends -y build-essential git libvips libyaml-dev pkg-config && \
|
|
36
|
-
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
|
37
|
-
|
|
38
|
-
# Install application gems
|
|
39
|
-
COPY vendor/* ./vendor/
|
|
40
|
-
COPY Gemfile Gemfile.lock ./
|
|
41
|
-
|
|
42
|
-
RUN bundle install && \
|
|
43
|
-
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
|
|
44
|
-
# -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
|
|
45
|
-
bundle exec bootsnap precompile -j 1 --gemfile
|
|
46
|
-
|
|
47
|
-
# Copy application code
|
|
48
|
-
COPY . .
|
|
49
|
-
|
|
50
|
-
# Precompile bootsnap code for faster boot times.
|
|
51
|
-
# -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
|
|
52
|
-
RUN bundle exec bootsnap precompile -j 1 app/ lib/
|
|
53
|
-
|
|
54
|
-
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
|
|
55
|
-
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# Final stage for app image
|
|
61
|
-
FROM base
|
|
62
|
-
|
|
63
|
-
# Run and own only the runtime files as a non-root user for security
|
|
64
|
-
RUN groupadd --system --gid 1000 rails && \
|
|
65
|
-
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash
|
|
66
|
-
USER 1000:1000
|
|
67
|
-
|
|
68
|
-
# Copy built artifacts: gems, application
|
|
69
|
-
COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
|
70
|
-
COPY --chown=rails:rails --from=build /rails /rails
|
|
71
|
-
|
|
72
|
-
# Entrypoint prepares the database.
|
|
73
|
-
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
|
74
|
-
|
|
75
|
-
# Start server via Thruster by default, this can be overwritten at runtime
|
|
76
|
-
EXPOSE 80
|
|
77
|
-
CMD ["./bin/thrust", "./bin/rails", "server"]
|
data/samples/book_store/Gemfile
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
source "https://rubygems.org"
|
|
2
|
-
|
|
3
|
-
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
|
4
|
-
gem "rails", "~> 8.1.3"
|
|
5
|
-
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
|
|
6
|
-
gem "propshaft"
|
|
7
|
-
# Use sqlite3 as the database for Active Record
|
|
8
|
-
gem "sqlite3", ">= 2.1"
|
|
9
|
-
# Use the Puma web server [https://github.com/puma/puma]
|
|
10
|
-
gem "puma", ">= 5.0"
|
|
11
|
-
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
|
12
|
-
gem "importmap-rails"
|
|
13
|
-
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
|
14
|
-
gem "turbo-rails"
|
|
15
|
-
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
|
16
|
-
gem "stimulus-rails"
|
|
17
|
-
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
|
18
|
-
gem "jbuilder"
|
|
19
|
-
|
|
20
|
-
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
|
21
|
-
# gem "bcrypt", "~> 3.1.7"
|
|
22
|
-
|
|
23
|
-
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
24
|
-
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
|
25
|
-
|
|
26
|
-
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
|
|
27
|
-
gem "solid_cache"
|
|
28
|
-
gem "solid_queue"
|
|
29
|
-
gem "solid_cable"
|
|
30
|
-
|
|
31
|
-
# Reduces boot times through caching; required in config/boot.rb
|
|
32
|
-
gem "bootsnap", require: false
|
|
33
|
-
|
|
34
|
-
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
|
35
|
-
gem "kamal", require: false
|
|
36
|
-
|
|
37
|
-
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
|
|
38
|
-
gem "thruster", require: false
|
|
39
|
-
|
|
40
|
-
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
|
41
|
-
gem "image_processing", "~> 1.2"
|
|
42
|
-
|
|
43
|
-
group :development, :test do
|
|
44
|
-
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
|
45
|
-
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
|
46
|
-
|
|
47
|
-
# Audits gems for known security defects (use config/bundler-audit.yml to ignore issues)
|
|
48
|
-
gem "bundler-audit", require: false
|
|
49
|
-
|
|
50
|
-
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
|
51
|
-
gem "brakeman", require: false
|
|
52
|
-
|
|
53
|
-
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
|
|
54
|
-
gem "rubocop-rails-omakase", require: false
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
group :development do
|
|
58
|
-
# Use console on exceptions pages [https://github.com/rails/web-console]
|
|
59
|
-
gem "web-console"
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
group :test do
|
|
63
|
-
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
|
64
|
-
gem "crspec", path: "../.."
|
|
65
|
-
gem "capybara"
|
|
66
|
-
gem "selenium-webdriver"
|
|
67
|
-
end
|