squcumber-postgres 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a32490ebd1135e0fbd4e527a37216e807a9092f137adb94fdead577c493930f3
|
4
|
+
data.tar.gz: ce7dfe1d4a27fc6329a8dcdb8b866084725650acb65b0f5f3aa847cce58ba2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4f385979a30214331d054dfc1b0e1cbc5a0c52b75f1991cc772949118762cbd3a85f658916fb5a1cdf3bd876eb7c41fd8f320b7dab8948907b9d4ad899dc67b
|
7
|
+
data.tar.gz: da362eb89ce0980d6a8beaeec97e1a46aac976543ecd67a3cba3bbeff04d7252365b304f8a3ad09e1ce7e6dd67aec21a575d471899c375f936cfdd990892e19e
|
@@ -82,13 +82,17 @@ end
|
|
82
82
|
|
83
83
|
When(/^the given SQL files are executed$/) do
|
84
84
|
silence_streams(STDERR) do
|
85
|
-
@sql_files_to_execute.each
|
85
|
+
@sql_files_to_execute.each do |file|
|
86
|
+
# This overwrites the result if multiple files are executed
|
87
|
+
@result = TESTING_DATABASE.exec_file(file).map { |e| e }
|
88
|
+
end
|
86
89
|
end
|
87
90
|
end
|
88
91
|
|
89
92
|
When(/^the SQL file "?([^\s"]+)"? is executed/) do |file|
|
90
93
|
silence_streams(STDERR) do
|
91
|
-
|
94
|
+
# This overwrites the result if multiple files are executed
|
95
|
+
@result = TESTING_DATABASE.exec_file("#{@sql_file_path}/#{file}").map { |e| e }
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
@@ -97,6 +101,13 @@ When(/^the resulting table "?([^\s"]*)"? is queried(?:, ordered by "?([^"]*)"?)?
|
|
97
101
|
@result = TESTING_DATABASE.query("select * from #{table} #{sort_statement};").map { |e| e }
|
98
102
|
end
|
99
103
|
|
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
|
+
|
100
111
|
Then(/^the result( with date placeholders)? starts with.*$/) do |placeholder, data|
|
101
112
|
actual = @result[0..(data.hashes.length - 1)] || []
|
102
113
|
expected = data.hashes || []
|
@@ -34,10 +34,10 @@ module MatcherHelpers
|
|
34
34
|
# 2 years ago (as year)
|
35
35
|
# => '2015'
|
36
36
|
#
|
37
|
-
# beginning of last month
|
37
|
+
# beginning of month last month
|
38
38
|
# => '2017-06-01'
|
39
39
|
#
|
40
|
-
# end of last year
|
40
|
+
# end of month last year
|
41
41
|
# => '2016-12-31'
|
42
42
|
#
|
43
43
|
# today (as custom '%Y-%m')
|
@@ -126,7 +126,6 @@ module MatcherHelpers
|
|
126
126
|
|
127
127
|
formatted_new_value = case format
|
128
128
|
when nil
|
129
|
-
puts "NO FORMAT"
|
130
129
|
modified_new_value.to_s
|
131
130
|
when 'day', 'month', 'year'
|
132
131
|
modified_new_value.send(format.to_sym)
|
@@ -137,13 +136,9 @@ module MatcherHelpers
|
|
137
136
|
raise "Invalid date format provided: #{format}"
|
138
137
|
end
|
139
138
|
|
140
|
-
formatted_new_value
|
139
|
+
formatted_new_value.to_s
|
141
140
|
else
|
142
|
-
new_value
|
141
|
+
new_value.to_s
|
143
142
|
end
|
144
143
|
end
|
145
144
|
end
|
146
|
-
|
147
|
-
if defined?(World)
|
148
|
-
World(MatcherHelpers)
|
149
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squcumber-postgres
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefanie Grunwald
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/squcumber-postgres/rake/task.rb
|
143
143
|
- lib/squcumber-postgres/step_definitions/common_steps.rb
|
144
144
|
- lib/squcumber-postgres/support/database.rb
|
145
|
+
- lib/squcumber-postgres/support/helpers.rb
|
145
146
|
- lib/squcumber-postgres/support/matchers.rb
|
146
147
|
- lib/squcumber-postgres/support/output.rb
|
147
148
|
- spec/spec_helper.rb
|