Skip to content

Commit b706292

Browse files
committed
Add result ordering step
1 parent ace9456 commit b706292

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/squcumber-postgres/step_definitions/common_steps.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@
101101
@result = TESTING_DATABASE.query("select * from #{table} #{sort_statement};").map { |e| e }
102102
end
103103

104+
When(/^the result is ordered by "?([^"]+)"?/) do |sort_columns_string|
105+
sort_columns = sort_columns_string.split(',').map { |sort_column| sort_column.strip }
106+
@result = @result.sort_by do |row|
107+
sort_columns.map { |sort_column| row[sort_column] }
108+
end
109+
end
110+
104111
Then(/^the result( with date placeholders)? starts with.*$/) do |placeholder, data|
105112
actual = @result[0..(data.hashes.length - 1)] || []
106113
expected = data.hashes || []

0 commit comments

Comments
 (0)