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

Feature/missing uploaders #81

Merged
merged 8 commits into from
Oct 17, 2019
Merged

Feature/missing uploaders #81

merged 8 commits into from
Oct 17, 2019

Conversation

tsubik
Copy link
Contributor

@tsubik tsubik commented Oct 15, 2019

I was planning to get rid of AWS in this PR, but I will do that tomorrow in a separate one.

Couple things here:

  • data uploader for geographies and changing the default CSV export template
  • missing keywords and natural hazards import/export for legislations
  • Events uploader
  • Events index page and also show/edit/delete
  • Add visibility status and legislation ids to Litigation importer

@tsubik tsubik marked this pull request as ready for review October 15, 2019 20:58
@tsubik tsubik requested review from simaob and kowal October 15, 2019 20:58
Copy link
Contributor

@simaob simaob left a comment

Choose a reason for hiding this comment

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

Nice set of changes! =)


legislation = Legislation.find_by(title: 'Climate Law')

expect(legislation.legislation_type).to eq('legislative')
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe expect(legislation).to have_attributes(..)?

legislation2 = create(:legislation)
updated_litigation = create(:litigation)

csv_content = <<-CSV
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand that this needs to be dynamic here, but can we still keep this in let-vars?

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 will see if that will be more readable, maybe if we split those tests to separate files to test only importer services.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, maybe we can move to lets just things like legislation2 , updated_litigation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, moving those values to let globally would make test less readable in this case. Everything declared directly in test makes things easier when the test file is too big. There should be either context or separate file, but I don't think we have time to refactor tests much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol, I should have picked MiniTest instead of RSpec, fewer things to remember. Minimalism FTW!


litigation = Litigation.find_by(title: 'Litigation number 1')

expect(litigation.jurisdiction.iso).to eq('GBR')
Copy link
Contributor

Choose a reason for hiding this comment

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

same here: have_attributes() matcher could be more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, have_attributes nice idea 👍

file_path = "#{Rails.root}/spec/support/fixtures/files/#{filename}"

if content.present?
file_path = "#{Rails.root}/tmp/litigation_sides.csv"
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, why we have reference to litigation_sides in generic fixture_file helper?:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh shit, good catch. That file name for tmp file does not actually matter but should be tmp/#{filename}

Copy link
Contributor

@kowal kowal left a comment

Choose a reason for hiding this comment

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

great job overall 👍 but I found some small things to sort out ;)

@tsubik tsubik merged commit a4a8202 into develop Oct 17, 2019
@simaob simaob deleted the feature/missing-uploaders branch October 30, 2019 10:22
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.

3 participants