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.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +86 -0
  3. data/README.md +1 -1
  4. data/lib/crspec/cli.rb +86 -5
  5. data/lib/crspec/configuration.rb +62 -9
  6. data/lib/crspec/dsl.rb +66 -2
  7. data/lib/crspec/example.rb +60 -6
  8. data/lib/crspec/example_group.rb +363 -63
  9. data/lib/crspec/execution_context.rb +10 -6
  10. data/lib/crspec/expectations.rb +62 -2
  11. data/lib/crspec/file_fixtures.rb +18 -0
  12. data/lib/crspec/formatters/progress_formatter.rb +37 -14
  13. data/lib/crspec/matchers.rb +642 -0
  14. data/lib/crspec/mock/argument_matchers.rb +157 -0
  15. data/lib/crspec/mock/double.rb +246 -13
  16. data/lib/crspec/mock/interceptor.rb +32 -9
  17. data/lib/crspec/mock/space.rb +14 -0
  18. data/lib/crspec/process_runner.rb +332 -0
  19. data/lib/crspec/rails/assets_shim.rb +33 -0
  20. data/lib/crspec/rails/database_isolation.rb +179 -8
  21. data/lib/crspec/rails/parallel.rb +29 -29
  22. data/lib/crspec/rails/request_helpers.rb +70 -14
  23. data/lib/crspec/rails/system_server.rb +7 -0
  24. data/lib/crspec/rails/warden_shim.rb +18 -0
  25. data/lib/crspec/runner.rb +143 -29
  26. data/lib/crspec/shared_examples.rb +70 -0
  27. data/lib/crspec/status_persistence.rb +46 -0
  28. data/lib/crspec/transpiler/cli.rb +106 -15
  29. data/lib/crspec/transpiler/rewriter.rb +179 -25
  30. data/lib/crspec/version.rb +1 -1
  31. data/lib/crspec.rb +6 -0
  32. data/lib/rspec/core.rb +2 -0
  33. data/lib/rspec/expectations.rb +2 -0
  34. data/lib/rspec/mocks.rb +2 -0
  35. data/lib/rspec/rails.rb +2 -0
  36. data/lib/rspec.rb +2 -0
  37. metadata +27 -156
  38. data/benchmark/README.md +0 -56
  39. data/benchmark/run.rb +0 -72
  40. data/benchmark/spec/user_service_crspec_spec.rb +0 -15
  41. data/benchmark/spec/user_service_rspec_spec.rb +0 -16
  42. data/benchmark/target_service.rb +0 -12
  43. data/benchmark/test/user_service_test.rb +0 -18
  44. data/demo.rb +0 -129
  45. data/samples/book_store/.dockerignore +0 -51
  46. data/samples/book_store/.gitattributes +0 -9
  47. data/samples/book_store/.github/dependabot.yml +0 -12
  48. data/samples/book_store/.github/workflows/ci.yml +0 -130
  49. data/samples/book_store/.gitignore +0 -35
  50. data/samples/book_store/.kamal/hooks/docker-setup.sample +0 -3
  51. data/samples/book_store/.kamal/hooks/post-app-boot.sample +0 -3
  52. data/samples/book_store/.kamal/hooks/post-deploy.sample +0 -14
  53. data/samples/book_store/.kamal/hooks/post-proxy-reboot.sample +0 -3
  54. data/samples/book_store/.kamal/hooks/pre-app-boot.sample +0 -3
  55. data/samples/book_store/.kamal/hooks/pre-build.sample +0 -51
  56. data/samples/book_store/.kamal/hooks/pre-connect.sample +0 -47
  57. data/samples/book_store/.kamal/hooks/pre-deploy.sample +0 -122
  58. data/samples/book_store/.kamal/hooks/pre-proxy-reboot.sample +0 -3
  59. data/samples/book_store/.kamal/secrets +0 -20
  60. data/samples/book_store/.rubocop.yml +0 -8
  61. data/samples/book_store/.ruby-version +0 -1
  62. data/samples/book_store/Dockerfile +0 -77
  63. data/samples/book_store/Gemfile +0 -67
  64. data/samples/book_store/Gemfile.lock +0 -572
  65. data/samples/book_store/README.md +0 -24
  66. data/samples/book_store/Rakefile +0 -6
  67. data/samples/book_store/app/assets/images/.keep +0 -0
  68. data/samples/book_store/app/assets/stylesheets/application.css +0 -10
  69. data/samples/book_store/app/controllers/application_controller.rb +0 -2
  70. data/samples/book_store/app/controllers/books_controller.rb +0 -30
  71. data/samples/book_store/app/controllers/comments_controller.rb +0 -21
  72. data/samples/book_store/app/controllers/concerns/.keep +0 -0
  73. data/samples/book_store/app/controllers/users_controller.rb +0 -21
  74. data/samples/book_store/app/helpers/application_helper.rb +0 -2
  75. data/samples/book_store/app/helpers/books_helper.rb +0 -2
  76. data/samples/book_store/app/helpers/comments_helper.rb +0 -2
  77. data/samples/book_store/app/helpers/users_helper.rb +0 -2
  78. data/samples/book_store/app/javascript/application.js +0 -3
  79. data/samples/book_store/app/javascript/controllers/application.js +0 -9
  80. data/samples/book_store/app/javascript/controllers/hello_controller.js +0 -7
  81. data/samples/book_store/app/javascript/controllers/index.js +0 -4
  82. data/samples/book_store/app/jobs/application_job.rb +0 -7
  83. data/samples/book_store/app/mailers/application_mailer.rb +0 -4
  84. data/samples/book_store/app/models/application_record.rb +0 -3
  85. data/samples/book_store/app/models/book.rb +0 -10
  86. data/samples/book_store/app/models/comment.rb +0 -6
  87. data/samples/book_store/app/models/concerns/.keep +0 -0
  88. data/samples/book_store/app/models/user.rb +0 -4
  89. data/samples/book_store/app/views/layouts/application.html.erb +0 -29
  90. data/samples/book_store/app/views/layouts/mailer.html.erb +0 -13
  91. data/samples/book_store/app/views/layouts/mailer.text.erb +0 -1
  92. data/samples/book_store/app/views/pwa/manifest.json.erb +0 -22
  93. data/samples/book_store/app/views/pwa/service-worker.js +0 -26
  94. data/samples/book_store/bin/brakeman +0 -7
  95. data/samples/book_store/bin/bundler-audit +0 -6
  96. data/samples/book_store/bin/ci +0 -6
  97. data/samples/book_store/bin/dev +0 -2
  98. data/samples/book_store/bin/docker-entrypoint +0 -8
  99. data/samples/book_store/bin/importmap +0 -4
  100. data/samples/book_store/bin/jobs +0 -6
  101. data/samples/book_store/bin/kamal +0 -16
  102. data/samples/book_store/bin/rails +0 -4
  103. data/samples/book_store/bin/rake +0 -4
  104. data/samples/book_store/bin/rubocop +0 -8
  105. data/samples/book_store/bin/setup +0 -35
  106. data/samples/book_store/bin/thrust +0 -5
  107. data/samples/book_store/config/application.rb +0 -27
  108. data/samples/book_store/config/boot.rb +0 -4
  109. data/samples/book_store/config/bundler-audit.yml +0 -5
  110. data/samples/book_store/config/cable.yml +0 -17
  111. data/samples/book_store/config/cache.yml +0 -16
  112. data/samples/book_store/config/ci.rb +0 -24
  113. data/samples/book_store/config/credentials.yml.enc +0 -1
  114. data/samples/book_store/config/database.yml +0 -45
  115. data/samples/book_store/config/deploy.yml +0 -119
  116. data/samples/book_store/config/environment.rb +0 -5
  117. data/samples/book_store/config/environments/development.rb +0 -78
  118. data/samples/book_store/config/environments/production.rb +0 -90
  119. data/samples/book_store/config/environments/test.rb +0 -53
  120. data/samples/book_store/config/importmap.rb +0 -7
  121. data/samples/book_store/config/initializers/assets.rb +0 -7
  122. data/samples/book_store/config/initializers/content_security_policy.rb +0 -29
  123. data/samples/book_store/config/initializers/filter_parameter_logging.rb +0 -8
  124. data/samples/book_store/config/initializers/inflections.rb +0 -16
  125. data/samples/book_store/config/locales/en.yml +0 -31
  126. data/samples/book_store/config/puma.rb +0 -42
  127. data/samples/book_store/config/queue.yml +0 -18
  128. data/samples/book_store/config/recurring.yml +0 -15
  129. data/samples/book_store/config/routes.rb +0 -17
  130. data/samples/book_store/config/storage.yml +0 -27
  131. data/samples/book_store/config.ru +0 -6
  132. data/samples/book_store/db/cable_schema.rb +0 -11
  133. data/samples/book_store/db/cache_schema.rb +0 -12
  134. data/samples/book_store/db/migrate/20260731035441_create_users.rb +0 -10
  135. data/samples/book_store/db/migrate/20260731035506_create_books.rb +0 -11
  136. data/samples/book_store/db/migrate/20260731035528_create_comments.rb +0 -11
  137. data/samples/book_store/db/queue_schema.rb +0 -129
  138. data/samples/book_store/db/schema.rb +0 -39
  139. data/samples/book_store/db/seeds.rb +0 -9
  140. data/samples/book_store/lib/tasks/.keep +0 -0
  141. data/samples/book_store/log/.keep +0 -0
  142. data/samples/book_store/public/400.html +0 -135
  143. data/samples/book_store/public/404.html +0 -135
  144. data/samples/book_store/public/406-unsupported-browser.html +0 -135
  145. data/samples/book_store/public/422.html +0 -135
  146. data/samples/book_store/public/500.html +0 -135
  147. data/samples/book_store/public/icon.png +0 -0
  148. data/samples/book_store/public/icon.svg +0 -3
  149. data/samples/book_store/public/robots.txt +0 -1
  150. data/samples/book_store/script/.keep +0 -0
  151. data/samples/book_store/spec/models/book_spec.rb +0 -42
  152. data/samples/book_store/spec/models/comment_spec.rb +0 -22
  153. data/samples/book_store/spec/models/user_advanced_spec.rb +0 -27
  154. data/samples/book_store/spec/models/user_spec.rb +0 -30
  155. data/samples/book_store/spec/rails_helper.rb +0 -36
  156. data/samples/book_store/spec/rails_parallel_spec.rb +0 -23
  157. data/samples/book_store/spec/requests/books_spec.rb +0 -21
  158. data/samples/book_store/spec/requests/users_spec.rb +0 -14
  159. data/samples/book_store/spec/services/inventory_service_spec.rb +0 -28
  160. data/samples/book_store/spec/services/time_dependent_service_spec.rb +0 -26
  161. data/samples/book_store/spec/spec_helper.rb +0 -16
  162. data/samples/book_store/spec/system/book_store_system_spec.rb +0 -18
  163. data/samples/book_store/storage/.keep +0 -0
  164. data/samples/book_store/test/controllers/.keep +0 -0
  165. data/samples/book_store/test/controllers/books_controller_test.rb +0 -7
  166. data/samples/book_store/test/controllers/comments_controller_test.rb +0 -7
  167. data/samples/book_store/test/controllers/users_controller_test.rb +0 -7
  168. data/samples/book_store/test/fixtures/books.yml +0 -11
  169. data/samples/book_store/test/fixtures/comments.yml +0 -11
  170. data/samples/book_store/test/fixtures/files/.keep +0 -0
  171. data/samples/book_store/test/fixtures/users.yml +0 -9
  172. data/samples/book_store/test/helpers/.keep +0 -0
  173. data/samples/book_store/test/integration/.keep +0 -0
  174. data/samples/book_store/test/mailers/.keep +0 -0
  175. data/samples/book_store/test/models/.keep +0 -0
  176. data/samples/book_store/test/models/book_test.rb +0 -7
  177. data/samples/book_store/test/models/comment_test.rb +0 -7
  178. data/samples/book_store/test/models/user_test.rb +0 -7
  179. data/samples/book_store/test/test_helper.rb +0 -15
  180. data/samples/book_store/tmp/.keep +0 -0
  181. data/samples/book_store/tmp/pids/.keep +0 -0
  182. data/samples/book_store/tmp/storage/.keep +0 -0
  183. data/samples/book_store/vendor/.keep +0 -0
  184. data/samples/book_store/vendor/javascript/.keep +0 -0
  185. data/samples/user_spec.rb +0 -31
  186. data/test/crspec/configuration_test.rb +0 -76
  187. data/test/crspec/execution_context_test.rb +0 -61
  188. data/test/crspec/mock_test.rb +0 -55
  189. data/test/crspec/rails_test.rb +0 -62
  190. data/test/crspec/runner_test.rb +0 -68
  191. data/test/crspec/transpiler_test.rb +0 -41
  192. 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"]
@@ -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