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

Moved polyamorous from gem to a module #1105

Closed

Conversation

shadabmalik1310
Copy link
Contributor

@shadabmalik1310 shadabmalik1310 commented Jan 21, 2020

Closes #1099

@scarroll32
Copy link
Member

Thanks @shadabmalik1310 I will review this later today.

Just some initial notes before the review:

Many thanks!

ransack.gemspec Outdated Show resolved Hide resolved
.to_not raise_error
end
end
# describe '#join_associations', if: AR_version <= '4.0' do
Copy link
Member

Choose a reason for hiding this comment

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

As we are not supporting AR <= 4 this test can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

.to match(%r{LEFT OUTER JOIN articles ON (\('default_scope' = 'default_scope'\) AND )?articles.person_id = people.id})
expect(real_query)
.to match(%r{LEFT OUTER JOIN articles articles_people ON (\('default_scope' = 'default_scope'\) AND )?articles_people.person_id = parents_people.id})
if ::Gem::Version.new(::ActiveRecord::VERSION::STRING) > ::Gem::Version.new(Constants::RAILS_6_0)
Copy link
Member

Choose a reason for hiding this comment

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

Can we also add an a test where the data for this condition is created, and we check that the output is the same across each version of AR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have tried but i couldn't find a way to change the dynamically change the version of AR. But i have tested with different versions without spec, it's fine.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @shadabmalik1310 the way to do this would to:

  • set up some data
  • check for an expected output of a Ransack query as data (not the SQL generated)
  • run it in CI for each different version of Rails

Copy link
Member

@scarroll32 scarroll32 left a comment

Choose a reason for hiding this comment

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

Hi @shadabmalik1310 this look good so far, great job 🥇

A few points:

@@ -1,4 +1,5 @@
require 'machinist/active_record'
require 'polyamorous/polyamorous.rb'
Copy link
Member

Choose a reason for hiding this comment

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

We need the specs from the Polyamorous gem added and passing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @seanfcarroll - All files are covered with the specs and coverage is 100%, let me know the file and line which is not covered with the spec.

Thanks

Copy link
Member

Choose a reason for hiding this comment

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

Could you please add in the code missing from here https://github.com/activerecord-hackery/polyamorous/blob/master/spec/polyamorous/join_association_spec.rb#L20-L37

Also, please move the Polyamorous tests under their own folder (at the same level as Ransack).

Thank you. :-)

@scarroll32
Copy link
Member

Thanks for the work @shadabmalik1310

If the review points are all now resolved, would it be possible to make a note and then resolve the conversation?

Let's get this merged!

@scarroll32
Copy link
Member

bump @shadabmalik1310

1 similar comment
@scarroll32
Copy link
Member

bump @shadabmalik1310

@varyonic varyonic mentioned this pull request Apr 3, 2020
@scarroll32
Copy link
Member

Closed as superceeded by #1113

@scarroll32 scarroll32 closed this Apr 4, 2020
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.

Convert Polyamorous into a module
3 participants