Skip to content

Commit

Permalink
Merge pull request #2854 from martinpovolny/report_data_selected_rand…
Browse files Browse the repository at this point in the history
…om_order

Tests: match_gtl_options should ignore order in :selected_records.
(cherry picked from commit 9dd4d49)
  • Loading branch information
mzazrivec authored and simaishi committed Nov 29, 2017
1 parent 756603b commit 5f49332
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec/support/controller_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,15 @@ def matches_basic(actual, expected)
expected.keys.find_all { |key| expected[key] != actual[key] }.empty?
end

def matches_selected_records(actual, expected)
return true unless expected
actual.sort == expected.sort
end

match do |actual|
additional_options = expected.delete(:report_data_additional_options)
matches_basic(actual, expected) && matches_additional(actual[:report_data_additional_options], additional_options)
selected_records = expected.delete(:selected_records)
matches_basic(actual, expected) && matches_additional(actual[:report_data_additional_options], additional_options) && matches_selected_records(actual[:selected_records], selected_records)
end
end
end
Expand Down

0 comments on commit 5f49332

Please sign in to comment.