-
Notifications
You must be signed in to change notification settings - Fork 526
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
Fix decoration spec #895
Fix decoration spec #895
Conversation
Looks like the integration specs are flaky, gonna check. |
Right, so they weren't flaky. Ruby 3 doesn't bundle the webrick gem anymore, so starting a server without mentioning it in the Gemfile wouldn't work. Also, newer versions of Rails need an activestorage configuration in order to work. Added those. |
072da06
to
f783d97
Compare
Righty, but I found a real flaky spec now. Could reproduce with |
Draper::CollectionDecorator#{is_a?,kind_of?} triggers decorating the object. When stubbing a method call on a CollectionDecorator, RSpec itself will call #is_a? on the object. See: https://github.com/rspec/rspec-mocks/blob/ea4d8ea4532480500462cc7a633d3408656a4dcd/lib/rspec/mocks/proxy.rb#L38 That's why the object will always be decorated when stubbing a method on it. We can circumvent this issue by directly checking the definition of @decorated_collection.
Newer versions of rails need a config/storage.yml in order to work.
Ruby 3 no longer bundles the webrick gem so we need to add it to the Gemfile.
When decorator_generator_spec.rb:51 was performed before or after another spec (not sure), it would fail. It has to do with requiring some rails constants. To reproduce, run: bundle exec rspec spec/generators --seed=53929 Fixed by correctly requiring other files.
dc51c26
to
490f734
Compare
Simplecov doesn't support Ruby 2.4 in newer versions and the latest possible version generates reports which are not processable by the code climate reporter. So it seems we're stuck with simplecov 0.17.1 until Ruby 2.4 is dropped: codeclimate/test-reporter#413 (comment)
490f734
to
51e9e21
Compare
@mgerst: Finally fixed it to green, but had to fixate simplecov to an old version. |
@codebycliff I think this one can be merged then #897 Then we'll have a green CI ready to be tested against Ruby 3.0 \o/ |
Also it could be great to have appraisal to test against different versions of Rails. wdyt? |
I think that would be awesome if someone wants to whip it up. We should also test against Ruby 3, but didn't want to make that change as part of the CI change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this! Sorry for my late reply on these.
I can do a PR for that. |
Draper::CollectionDecorator#{is_a?,kind_of?} triggers
decorating the object. When stubbing a method call
on a CollectionDecorator, RSpec itself will call #is_a?
on the object. See:
https://github.com/rspec/rspec-mocks/blob/ea4d8ea4532480500462cc7a633d3408656a4dcd/lib/rspec/mocks/proxy.rb#L38
That's why the object will always be decorated when
stubbing a method on it.
We can circumvent this issue by directly checking
the definition of @decorated_collection.
Edit:
This PR got bigger than intended, but it fixes more failing and flaky specs.