Skip to content

test: Rails 風イデオムの探索スペックを追加#98

Draft
sorafujitani wants to merge 1 commit intomainfrom
cursor/-bc-9e4b4932-5636-478b-96ab-7492eb187380-12a1
Draft

test: Rails 風イデオムの探索スペックを追加#98
sorafujitani wants to merge 1 commit intomainfrom
cursor/-bc-9e4b4932-5636-478b-96ab-7492eb187380-12a1

Conversation

@sorafujitani
Copy link
Copy Markdown
Owner

Description

Rails アプリでよく使う Ruby 構文(マイグレーション、モデル、コントローラ、ルーティング、ジョブ、メーラー、Concern、初期化フック、STI など)を題材に、Rfmt.format の後に Prism で構文エラーが出ないことと、フォーマッタ内部表現が出力に漏れないことを検証する RSpec を追加しました。

Motivation

Rails 向けの回帰を網羅的に拾うため、既存の単発スペックに加えて代表的なイデオムをまとめた探索テストを置きます。

Fixes #
Related to #

Changes

  • spec/rails_idioms_spec.rb を新規追加(9 例)
  • .gitignorevendor/bundle/ を追加(ローカル bundle install --path vendor/bundle 用)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Refactoring (no functional changes, improves code quality)
  • Breaking change (fix or feature that would change existing functionality)
  • Documentation update
  • Test addition/update

Testing

  • All existing tests pass (bundle exec rspec)
  • Rust tests pass (cd ext/rfmt && cargo test)
  • Added new tests for new functionality
  • Manually tested with the following scenarios:

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my code
  • I have commented my code in hard-to-understand areas
  • I have updated documentation if needed
  • My changes generate no new warnings (cargo clippy)
  • I have added tests that prove my fix/feature works

Screenshots / Examples

Before
# N/A — テスト追加のみ
After
# spec/rails_idioms_spec.rb で Rails 風スニペットを format → Prism で検証

Additional Notes

CI 環境では従来どおりフルスイートが走ります。ローカルで vendor/bundle を使う場合は .gitignore で除外されます。

Open in Web Open in Cursor 

Cover migrations, models, controllers, routes, jobs, mailers,
ActiveSupport::Concern, initializers, and STI patterns. Each example
asserts Prism parse cleanliness and absence of leaked AST internals.

Co-authored-by: fujitani sora <fujitanisora0414@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants