mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Linter noise
This commit is contained in:
@@ -44,11 +44,11 @@ class ReportsController < ApplicationController
|
|||||||
@period_type = params[:period_type]&.to_sym || :monthly
|
@period_type = params[:period_type]&.to_sym || :monthly
|
||||||
@start_date = parse_date_param(:start_date) || default_start_date
|
@start_date = parse_date_param(:start_date) || default_start_date
|
||||||
@end_date = parse_date_param(:end_date) || default_end_date
|
@end_date = parse_date_param(:end_date) || default_end_date
|
||||||
|
|
||||||
# Validate and fix date range if end_date is before start_date
|
# Validate and fix date range if end_date is before start_date
|
||||||
# Don't show flash message since we're returning CSV data
|
# Don't show flash message since we're returning CSV data
|
||||||
validate_and_fix_date_range(show_flash: false)
|
validate_and_fix_date_range(show_flash: false)
|
||||||
|
|
||||||
@period = Period.custom(start_date: @start_date, end_date: @end_date)
|
@period = Period.custom(start_date: @start_date, end_date: @end_date)
|
||||||
|
|
||||||
# Build monthly breakdown data for export
|
# Build monthly breakdown data for export
|
||||||
|
|||||||
@@ -95,13 +95,13 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
test "index swaps dates when end_date is before start_date" do
|
test "index swaps dates when end_date is before start_date" do
|
||||||
start_date = Date.current
|
start_date = Date.current
|
||||||
end_date = 1.month.ago.to_date
|
end_date = 1.month.ago.to_date
|
||||||
|
|
||||||
get reports_path(
|
get reports_path(
|
||||||
period_type: :custom,
|
period_type: :custom,
|
||||||
start_date: start_date.to_s,
|
start_date: start_date.to_s,
|
||||||
end_date: end_date.to_s
|
end_date: end_date.to_s
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_response :ok
|
assert_response :ok
|
||||||
# Should show flash message about invalid date range
|
# Should show flash message about invalid date range
|
||||||
assert flash[:alert].present?, "Flash alert should be present"
|
assert flash[:alert].present?, "Flash alert should be present"
|
||||||
@@ -208,14 +208,14 @@ class ReportsControllerTest < ActionDispatch::IntegrationTest
|
|||||||
test "export transactions swaps dates when end_date is before start_date" do
|
test "export transactions swaps dates when end_date is before start_date" do
|
||||||
start_date = Date.current
|
start_date = Date.current
|
||||||
end_date = 1.month.ago.to_date
|
end_date = 1.month.ago.to_date
|
||||||
|
|
||||||
get export_transactions_reports_path(
|
get export_transactions_reports_path(
|
||||||
format: :csv,
|
format: :csv,
|
||||||
period_type: :custom,
|
period_type: :custom,
|
||||||
start_date: start_date.to_s,
|
start_date: start_date.to_s,
|
||||||
end_date: end_date.to_s
|
end_date: end_date.to_s
|
||||||
)
|
)
|
||||||
|
|
||||||
assert_response :ok
|
assert_response :ok
|
||||||
assert_equal "text/csv", @response.media_type
|
assert_equal "text/csv", @response.media_type
|
||||||
# Verify the CSV content is generated (should not crash)
|
# Verify the CSV content is generated (should not crash)
|
||||||
|
|||||||
Reference in New Issue
Block a user