squcumber-redshift 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzdjMGUxNzI3YmEzMDgwZjFkNDlmZjkwZWQ2NzE2MGQ1N2I0N2I3OA==
4
+ Nzk4NGE2ZWNiNDQ3MmJkNDI4MjJjZjRlNTlmNjEzN2M3MDAzMDFiMA==
5
5
  data.tar.gz: !binary |-
6
- YjliOWUwMmI5ZTlmODMwMTMyZGI5OGUzM2QxYjg4ZmY0ZjBiZWRiYg==
6
+ MGRjZGYzNzYyZGZhZWJlYzlmNWQ3ZWZjMDRiZDQwNDU0YmY3NWYwZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTliMjU1MjMwMWEyMGYwNGJiYWJlNDAxMmExZTE2N2MxODNkYzRkNzNlYTIz
10
- MTA5YzhjNzhjODNiYmVlNTZjZTUwMzRlNmI4Zjk5NzBiNTRmMTAwY2M0MDg3
11
- YzNlZmE2ZDFkMDc2MmJmMjNhYTFiMmRhMDljNjI2NjMyYmU1MzU=
9
+ ZTQ0MmMwNmU4N2FmMDJjZjlhZmMyNjY3YjczMTk1YzBjN2IzOGVlMmY5NTFk
10
+ ZmVmNmNjOGVlYWUyODRkNmFkOTdjOTM1OWY1ZDVlOTA5Nzg0N2QxYzYwZDUx
11
+ NDZiNDljY2QxYmJiNDc3NTVjMzc1MGI4MTBiYjBhYmMxYzVkYmY=
12
12
  data.tar.gz: !binary |-
13
- NmY2YjhhZjJlMjc2YmQ0OTdjOWYxZGJmZDU4OTEwMGU0YzA0Y2YzYTE5NGNh
14
- ODRmYjZhNDRhNTE0N2M3N2JjM2IwYWVlNjBlZmE4ZTRmYzY1ZWZhMWMyMTli
15
- ZDg4MmRmY2NmNGY4OWZhNGJiNTM2NWNiMDk0MTFkMjc2M2IzNGQ=
13
+ YjA4NTY1ZTkyNTlkMzhhMjRkZjMxY2M5OWU4NGE3ZDIyNTk3NzU4NzIzYmVh
14
+ ZGQ0ZDdlMWE3MzIzYTgyNWJhYWJjNGRhODRlYTU4ZGE1ZWYzNDkwODlhMDI4
15
+ NjYxZjYzNDc3NDNkZjgyOWFjMjY4ODAwNDQ3MjQwY2RlNmJkYjM=
@@ -28,7 +28,10 @@ module Squcumber
28
28
  end
29
29
 
30
30
  def setup(schemas)
31
- schemas.each { |schema| exec("create schema #{schema}") }
31
+ schemas.each do |schema|
32
+ exec("drop schema if exists #{schema} cascade")
33
+ exec("create schema #{schema}")
34
+ end
32
35
  end
33
36
 
34
37
  def truncate_all_tables
@@ -1,7 +1,14 @@
1
1
  require 'json'
2
2
 
3
- Before do
4
- $setup ||= false
3
+ $feature_name ||= ''
4
+ $setup ||= false
5
+
6
+ Before do |scenario|
7
+ current_scenario_name = scenario.feature.name rescue nil
8
+ if current_scenario_name != $feature_name
9
+ $feature_name = current_scenario_name
10
+ $setup = false
11
+ end
5
12
  end
6
13
 
7
14
  # Takes a path and then sequentially adds what's provided in `data`
@@ -13,5 +13,5 @@ puts 'DONE.'
13
13
  TESTING_DATABASE ||= Squcumber::Redshift::Mock::Database.new(production_database)
14
14
 
15
15
  at_exit do
16
- TESTING_DATABASE.destroy
16
+ TESTING_DATABASE.destroy rescue nil
17
17
  end
@@ -155,6 +155,23 @@ module Squcumber::Redshift::Mock
155
155
  end
156
156
  end
157
157
 
158
+ describe '#setup' do
159
+ let(:schemas) { ['some_schema', 'another_schema'] }
160
+
161
+ before(:each) do
162
+ @dummy = described_class.new(production_database)
163
+ allow(@dummy).to receive(:exec)
164
+ @dummy.setup(schemas)
165
+ end
166
+
167
+ it 'drops and creates all schemas' do
168
+ expect(@dummy).to have_received(:exec).with('drop schema if exists some_schema cascade').ordered
169
+ expect(@dummy).to have_received(:exec).with('create schema some_schema').ordered
170
+ expect(@dummy).to have_received(:exec).with('drop schema if exists another_schema cascade').ordered
171
+ expect(@dummy).to have_received(:exec).with('create schema another_schema').ordered
172
+ end
173
+ end
174
+
158
175
  describe '#truncate_all_tables' do
159
176
  let(:existing_tables) { ['some_schema.some_table', 'some_other_schema.some_other_table'] }
160
177
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squcumber-redshift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefanie Grunwald