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

Do not generate file fixture methods #1506

Merged
merged 1 commit into from
May 19, 2023
Merged

Do not generate file fixture methods #1506

merged 1 commit into from
May 19, 2023

Conversation

sambostock
Copy link
Contributor

Motivation

Tapioca currently erroneously generates methods for file fixtures.

For example if one were to create the following file in a Rails app

# test/fixtures/files/greetings.yml
Hello: there

Tapioca would generate the following RBI:

class ActiveSupport::TestCase
  sig { params(fixture_names: T.any(String, Symbol)).returns(T.untyped) }
  def files_greetings(*fixture_names); end
end

But that method does not exist.

Implementation

By defining file_fixture_path, ActiveRecord::TestFixtures skips over the directory.

See https://github.com/rails/rails/blob/7c70791470fc517deb7c640bead9f1b47efb5539/activerecord/lib/active_record/test_fixtures.rb#L46

Tests

A test is which includes a file fixture and asserts no method is defined for it.

@sambostock sambostock requested a review from a team as a code owner May 18, 2023 17:54
Copy link
Contributor

@egiurleo egiurleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! Let's wait for another review from Ruby DX before merging.

@Morriar Morriar merged commit a8b77b8 into main May 19, 2023
30 checks passed
@Morriar Morriar deleted the no-file-fixture-rbi branch May 19, 2023 14:34
@shopify-shipit shopify-shipit bot temporarily deployed to production June 23, 2023 18:32 Inactive
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.

None yet

4 participants