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

Raise error when a trait is self-referencing #1294

Merged
merged 1 commit into from
Sep 10, 2019
Merged

Conversation

hellosweta
Copy link
Contributor

@hellosweta hellosweta commented May 3, 2019

We want to check if any attributes of a new trait definition matches the name of
the trait. Raise an error if so, to avoid a recursive call to the trait. A fix to:
#1238

spec/acceptance/traits_spec.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/definition_proxy.rb Outdated Show resolved Hide resolved
@hellosweta hellosweta force-pushed the ss-self-ref-trait branch 2 times, most recently from b61d2fe to 628579b Compare May 4, 2019 00:25
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
@hellosweta hellosweta changed the title WIP check if name matches name passed through the block WIP Fix "Self-referencing association" error for traits #1238 May 10, 2019
spec/acceptance/traits_spec.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/trait.rb Outdated Show resolved Hide resolved
lib/factory_bot/declaration/implicit.rb Outdated Show resolved Hide resolved
lib/factory_bot/declaration/implicit.rb Outdated Show resolved Hide resolved
@hellosweta hellosweta force-pushed the ss-self-ref-trait branch 2 times, most recently from ab10591 to cb66970 Compare August 9, 2019 18:29
@hellosweta hellosweta force-pushed the ss-self-ref-trait branch 2 times, most recently from a8d5729 to 70cc046 Compare August 9, 2019 19:58
@hellosweta hellosweta changed the title WIP Fix "Self-referencing association" error for traits #1238 Raise error when a trait is self-referencing Aug 9, 2019
@hellosweta hellosweta marked this pull request as ready for review August 9, 2019 20:00
Copy link
Contributor

@odlp odlp left a comment

Choose a reason for hiding this comment

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

Looks great 👍

If a new trait is defined with attributes,  check if attributes matches the name of
the trait. Raise an error if so, to avoid a recursive call to the
trait.

Co-authored-by: Daniel Colsen <daniel.j.colson@thoughtbot.com>
Co-authored-by: Paras Sanghavi <sanghaviparas@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.

None yet

5 participants