You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've reproduced this example failure locally as follows:
bundle exec rspec --seed 58786 spec/concepts/project/create_remix_spec.rb:125
The problem was with the `component` factory using `Faker::Lorem.word`
to generate `Component#name` [1] and then the example relying on the
order of components which is partly based on `Component#name` [2]. And
thus depending on the value of the generated name,
`remixed_project.components.first` in the example didn't always refer to
the component that the author intended and the assertion would fail,
e.g. with the seed value of 58786, the original component had the name
"ad" which comes before the new component name of "added_component"
alphabetically.
While I have some reservations about the use of Faker in spec setup, the
simplest way to fix this is to find the new component by name before
asserting against its attribute values.
[1]: https://github.com/RaspberryPiFoundation/editor-api/blob/f397e870f2a33cce1f53b9104c52314f5233572c/spec/factories/component.rb#L5
[2]: https://github.com/RaspberryPiFoundation/editor-api/blob/f397e870f2a33cce1f53b9104c52314f5233572c/app/models/project.rb#L14
0 commit comments