-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
☔ View full report in Codecov by Sentry. |
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.
This pr needs specs to check that the exports work as intented
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.
Thanks, I have a couple of doubts!
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 |
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.
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") |
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.
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
Co-authored-by: Ivan Vergés <[email protected]>
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.
wonderful!
fixes stadtluzern/decidim-pdf-consultations#48