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

Yank SQL file loading #81

Merged
merged 1 commit into from
Jun 30, 2024
Merged

Yank SQL file loading #81

merged 1 commit into from
Jun 30, 2024

Conversation

kaspth
Copy link
Owner

@kaspth kaspth commented Jun 29, 2024

If you need to test something like Marshal parsing between different Ruby/Rails versions, it's pretty easy to insert your SQL dump directly into your test case, like so:

setup do
  ActiveRecord::Base.connection.execute <<~SQL
    INSERT INTO users (name, email_address, created_at, updated_at) VALUES ('pagination.sql', 'pagination@example.com', TIME('NOW'), TIME('NOW'))
  SQL
end

If the SQL is too long, users can use file_fixture("sqls/pagination.sql").read or similar to set it up.

I don't think Oaken needs to ship a more complex wrapper around this.

@tcannonfodder you originally requested this, what do you think?

If you need to test something like Marshal parsing between different Ruby/Rails versions,
it's pretty easy to insert your SQL dump directly into your test case, like so:

```ruby
setup do
  ActiveRecord::Base.connection.execute <<~SQL
    INSERT INTO users (name, email_address, created_at, updated_at) VALUES ('pagination.sql', 'pagination@example.com', TIME('NOW'), TIME('NOW'))
  SQL
end
```

If the SQL is too long, users can use `file_fixture("sqls/pagination.sql").read` or similar
to set it up.

I don't think Oaken needs to ship a more complex wrapper around this.
@tcannonfodder
Copy link
Collaborator

I agree! I requested it, but as we've worked more in Oaken (and it's developed), it's clear that you can just pull in the tooling you need for edge cases & such. No reason to muck up the library at its core

@kaspth
Copy link
Owner Author

kaspth commented Jun 30, 2024

Nice, let's snip! ✂️

@kaspth kaspth merged commit 5691526 into main Jun 30, 2024
2 checks passed
@kaspth kaspth deleted the yank-sql-loading branch June 30, 2024 15:26
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