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

[Question] Guide to how to write spec tests #708

Open
Piioo opened this issue Jun 13, 2024 · 0 comments
Open

[Question] Guide to how to write spec tests #708

Piioo opened this issue Jun 13, 2024 · 0 comments

Comments

@Piioo
Copy link

Piioo commented Jun 13, 2024

Hello,

is there a Guide how to write spec tests?

We have enabled Bullet.raise in our specs.

Now when we load an object with associations, bullet tells us to includes([:foo]) to our code, that is really nice.

But when we test the same class object which does have an empty array of associations, then bullet tells us to remove the includes.

How to avoid this problems?

def show
  # when the object foo exists we need the includes, when the object does not exists bullet says -> remove includes
  foo = Foo.includes(:bars).find(params[:id])

rescue ActiveRecord::RecordNotFound
  ...
end
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