squcumber-postgres 0.0.1 → 0.0.4

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
- SHA1:
3
- metadata.gz: 0db456e704910175875824a14312d2c5668569d8
4
- data.tar.gz: 9e198d71fd8649646683b2df6be14a88e139a662
2
+ SHA256:
3
+ metadata.gz: 70197c6e99837cc7f6a50448932fbf35ec302afe947c4bfcd44a01e7f3932e92
4
+ data.tar.gz: 922ede0dc2311200bbc309d216237f9e79034642801503d837453c2c6a6ed183
5
5
  SHA512:
6
- metadata.gz: 8f9db0cd15453cd1fac71a582fd821b56f1cf51fbc22d88e1446fdf1e7673383e2617a9c769e4db6f4877b092ea165fd6e46e0c2865538711dac00ed1e0f97a1
7
- data.tar.gz: 4786343ae7714bfc33bc1779008a1aaacd85dd3569f5a09c9e673e076f5c96bfd532e776fed95da0c18034c90037229e864970d55e0122697eceecb5f57486ef
6
+ metadata.gz: 0356e70c0657e311013139b44759f6b321ec16b31c8354e763892293d86e796dabc0e6cfb5e4c2f25a379abee5fc0af0a44f1036c497cccac2747ebb28358db8
7
+ data.tar.gz: 5cce4bb175805a4e90e34e248279885e012f092fb74eb94aa84825b159eea95976719e6ef04383d33b29a011e8281af46d7e861d831b1351f2297fa33e547754
@@ -14,29 +14,42 @@ module Squcumber
14
14
  @features_dir = File.join(FileUtils.pwd, 'features')
15
15
  features = Dir.glob("#{@features_dir}/**/*.feature")
16
16
  parent_directories = features.map { |f| f.split('/')[0..-2].join('/') }.uniq
17
-
18
17
  features.each do |feature|
19
- feature_name = feature.gsub(File.join(FileUtils.pwd, 'features/'), '').gsub('.feature', '')
18
+ feature_name = feature.gsub(@features_dir + '/', '').gsub('.feature', '')
20
19
  task_name = feature_name.gsub('/', ':')
21
20
  desc "Run SQL tests for feature #{feature_name}"
22
21
  task "sql:#{task_name}".to_sym, [:scenario_line_number] do |_, args|
23
22
  cucumber_task_name = "cucumber_#{task_name}".to_sym
24
23
  ::Cucumber::Rake::Task.new(cucumber_task_name) do |t|
25
24
  line_number = args[:scenario_line_number].nil? ? '' : ":#{args[:scenario_line_number]}"
26
- t.cucumber_opts = "#{feature}#{line_number} --format pretty --format html --out #{feature_name.gsub('/','_')}.html --require #{File.dirname(__FILE__)}/../support --require #{File.dirname(__FILE__)}/../step_definitions"
25
+ output_dir = ENV['CUSTOM_OUTPUT_DIR'] ? ENV['CUSTOM_OUTPUT_DIR'] : '/tmp'
26
+ output_file = ENV['CUSTOM_OUTPUT_NAME'] ? ENV['CUSTOM_OUTPUT_NAME'] : feature_name.gsub('/', '_')
27
+ output_path = output_dir + '/' + output_file
28
+ output_opts = "--format html --out #{output_path}.html --format json --out #{output_path}.json"
29
+ extra_config = ENV['SQUCUMBER_OPTIONS_EXTRA']
30
+ t.cucumber_opts = "#{feature}#{line_number} --format pretty #{output_opts} --require #{File.dirname(__FILE__)}/../support --require #{File.dirname(__FILE__)}/../step_definitions #{ENV['CUSTOM_STEPS_DIR'] ? '--require ' + ENV['CUSTOM_STEPS_DIR'] : ''} #{extra_config}"
27
31
  end
28
32
  ::Rake::Task[cucumber_task_name].execute
29
33
  end
30
34
  end
31
35
 
32
36
  parent_directories.each do |feature|
33
- feature_name = feature.gsub(File.join(FileUtils.pwd, 'features/'), '').gsub('.feature', '')
37
+ feature_name = feature.gsub(@features_dir + '/', '')
34
38
  task_name = feature_name.gsub('/', ':')
35
- desc "Run SQL tests for all features in #{feature_name}"
39
+ if feature_name.eql?(@features_dir)
40
+ feature_name = 'features'
41
+ task_name = 'all'
42
+ end
43
+ desc "Run SQL tests for all features in /#{feature_name}"
36
44
  task "sql:#{task_name}".to_sym do
37
45
  cucumber_task_name = "cucumber_#{task_name}".to_sym
38
46
  ::Cucumber::Rake::Task.new(cucumber_task_name) do |t|
39
- t.cucumber_opts = "#{feature} --format pretty --format html --out #{feature_name.gsub('/','_')}.html --require #{File.dirname(__FILE__)}/../support --require #{File.dirname(__FILE__)}/../step_definitions"
47
+ output_dir = ENV['CUSTOM_OUTPUT_DIR'] ? ENV['CUSTOM_OUTPUT_DIR'] : '/tmp'
48
+ output_file = ENV['CUSTOM_OUTPUT_NAME'] ? ENV['CUSTOM_OUTPUT_NAME'] : feature_name.gsub('/', '_')
49
+ output_path = output_dir + '/' + output_file
50
+ output_opts = "--format html --out #{output_path}.html --format json --out #{output_path}.json"
51
+ extra_config = ENV['SQUCUMBER_OPTIONS_EXTRA']
52
+ t.cucumber_opts = "#{feature} --format pretty #{output_opts} --require #{File.dirname(__FILE__)}/../support --require #{File.dirname(__FILE__)}/../step_definitions #{ENV['CUSTOM_STEPS_DIR'] ? '--require ' + ENV['CUSTOM_STEPS_DIR'] : ''} #{extra_config}"
40
53
  end
41
54
  ::Rake::Task[cucumber_task_name].execute
42
55
  end
@@ -86,7 +86,7 @@ When(/^the given SQL files are executed$/) do
86
86
  end
87
87
  end
88
88
 
89
- When(/^the SQL file "?([^\s]+)"? is executed/) do |file|
89
+ When(/^the SQL file "?([^\s"]+)"? is executed/) do |file|
90
90
  silence_streams(STDERR) do
91
91
  TESTING_DATABASE.exec_file("#{@sql_file_path}/#{file}")
92
92
  end
@@ -97,9 +97,10 @@ When(/^the resulting table "?([^\s"]*)"? is queried(?:, ordered by "?([^"]*)"?)?
97
97
  @result = TESTING_DATABASE.query("select * from #{table} #{sort_statement};").map { |e| e }
98
98
  end
99
99
 
100
- Then(/^the result starts with.*$/) do |data|
100
+ Then(/^the result( with date placeholders)? starts with.*$/) do |placeholder, data|
101
101
  actual = @result[0..(data.hashes.length - 1)] || []
102
102
  expected = data.hashes || []
103
+ expected = convert_mock_values(expected) if placeholder
103
104
 
104
105
  expected.each_with_index do |hash, i|
105
106
  raise("Does not start with expected result, got:\n#{format_error(data, actual)}") unless actual[i].all? do |key, value|
@@ -108,9 +109,10 @@ Then(/^the result starts with.*$/) do |data|
108
109
  end
109
110
  end
110
111
 
111
- Then(/^the result includes.*$/) do |data|
112
+ Then(/^the result( with date placeholders)? includes.*$/) do |placeholder, data|
112
113
  actual = @result || []
113
114
  expected = data.hashes || []
115
+ expected = convert_mock_values(expected) if placeholder
114
116
 
115
117
  expected.each do |hash|
116
118
  raise("Result is not included, got:\n#{format_error(data, actual)}") unless actual.any? do |row|
@@ -121,9 +123,10 @@ Then(/^the result includes.*$/) do |data|
121
123
  end
122
124
  end
123
125
 
124
- Then(/^the result does not include.*$/) do |data|
126
+ Then(/^the result( with date placeholders)? does not include.*$/) do |placeholder, data|
125
127
  actual = @result || []
126
128
  expected = data.hashes || []
129
+ expected = convert_mock_values(expected) if placeholder
127
130
 
128
131
  expected.each do |hash|
129
132
  raise("Result is included, got:\n#{format_error(data, actual)}") if actual.any? do |row|
@@ -134,9 +137,10 @@ Then(/^the result does not include.*$/) do |data|
134
137
  end
135
138
  end
136
139
 
137
- Then(/^the result exactly matches.*$/) do |data|
140
+ Then(/^the result( with date placeholders)? exactly matches.*$/) do |placeholder, data|
138
141
  actual = @result || []
139
142
  expected = data.hashes || []
143
+ expected = convert_mock_values(expected) if placeholder
140
144
 
141
145
  raise("Does not match exactly, got:\n#{format_error(data, actual)}") if actual.length != expected.length
142
146
 
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.1
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefanie Grunwald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-01 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -166,10 +166,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  requirements: []
168
168
  rubyforge_project:
169
- rubygems_version: 2.6.3
169
+ rubygems_version: 2.7.6
170
170
  signing_key:
171
171
  specification_version: 3
172
- summary: Define and execute SQL integration tests for AWS postgres
172
+ summary: Define and execute SQL integration tests for Postgres databases
173
173
  test_files:
174
174
  - spec/spec_helper.rb
175
175
  - spec/squcumber-postgres/mock/database_spec.rb