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

Export suggestions as admin #99

Merged
merged 9 commits into from
Oct 25, 2023
Merged

Export suggestions as admin #99

merged 9 commits into from
Oct 25, 2023

Conversation

antopalidi
Copy link
Member

@antopalidi antopalidi commented Sep 13, 2023

@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0b83ff7) 94.33% compared to head (66834de) 94.72%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
+ Coverage   94.33%   94.72%   +0.38%     
==========================================
  Files          66       67       +1     
  Lines        1412     1516     +104     
==========================================
+ Hits         1332     1436     +104     
  Misses         80       80              
Files Coverage Δ
...idim/participatory_documents/needs_pdf_document.rb 95.00% <100.00%> (ø)
...rticipatory_documents/export_my_suggestions_job.rb 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

This pr needs specs to check that the exports work as intented

Copy link
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

Thanks, I have a couple of doubts!

Comment on lines +230 to +235
around do |example|
original_setting = ActionController::Base.allow_forgery_protection
ActionController::Base.allow_forgery_protection = true
example.run
ActionController::Base.allow_forgery_protection = original_setting
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this?
is not the user clicking on the export button? shoudn't the authenticity_token be present already?


perform_enqueued_jobs { click_button "Send me my suggestions" }

expect(page).to have_content("2 suggestions have been successfully exported")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check here the content of the email too?

 attachment = last_email.attachments.first

      Zip::File.open_buffer(attachment.body.raw_source) do |zip_file|
        json_file_entry = zip_file.glob("*.json").first
        json_content = json_file_entry.get_input_stream.read
        json_data = JSON.parse(json_content)
        expect(json_data.length).to eq(all_suggestions_count)
      end

Copy link
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

wonderful!

@microstudi microstudi merged commit e69916b into main Oct 25, 2023
3 checks passed
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.

Export suggestions as admin
2 participants