Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration for custom spec directory #991

Open
originalhat opened this issue Jun 26, 2023 · 0 comments
Open

Configuration for custom spec directory #991

originalhat opened this issue Jun 26, 2023 · 0 comments

Comments

@originalhat
Copy link

We're breaking apart a monolithic application into discrete business domains and are running into an issue configuring annotate_models to annotate specs under our new file structure. Fortunately we've been able to make this work for models by providing the following configuration:

'model_dir' => "app/models, #{Dir['domains/*/models'].join(', ')}",

However, we'd also like to be able to do this with spec files:

'additional_file_patterns' => Dir['domains/*/spec/models/**/*.rb'],

This matches the files correctly, but incorrectly annotates them (note: the table name ≠ model name):

# == Schema Information
#
# Table name: claim_precertifications
#
#  id                  :bigint           not null, primary key
#  created_at          :datetime         not null
#  updated_at          :datetime         not null
#  claim_id            :bigint
#  precertification_id :bigint
#
# Indexes
#
#  index_claim_precertifications_on_claim_id             (claim_id)
#  index_claim_precertifications_on_precertification_id  (precertification_id)
#
# Foreign Keys
#
#  fk_rails_...  (claim_id => claims.id)
#  fk_rails_...  (precertification_id => precertifications.id)
#
require 'rails_helper'

RSpec.describe CareNetwork::Models::ProviderSelfNomination, type: :model do
  ...

Commands

$ docker compose run --rm app rake annotate_models

Versions

  • annotate (3.2.0)
  • rails (7.0.5)
  • ruby "2.7.6"
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

No branches or pull requests

1 participant