pseudo_cleaner 0.0.33 → 0.0.34

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
- ODgxMjJmODBkNTRhMTIyMjQyMzM2NjQyNzgyYjlkZWM1OTZkMTJhZA==
4
+ YjA5OTAwZDY1ZTllMjM2MTVjZjYxYjFjOGUyMzkzMWZlYTVkNWIyNg==
5
5
  data.tar.gz: !binary |-
6
- YmZlM2NhOTJiYTYzZDVkNGNjMmVhMjMxYmY1YTVlNTBkNjE4NTEwZg==
6
+ YzdmYjI1YmRhODRiYjc2ZDc1MTQ1ZjlhMzg3Mzc4YmJhODIyYzA4NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjY2YWQwM2I4YmRiYTY2YTlkNmQ1OWQ1M2VmZGRmOTJkNjRiNzAyZjUxNjQ0
10
- MDVlNjU0OTU1ZmNjYmQ0YWRlNGExOTc0YzRlNTA3MjAxZDNmNzQ4MmJhY2Y0
11
- YTdlMTRjMzlhMDYwMzYwN2MzZmQ4NzY3Yzg5MzMwNDI5ZTNkMDc=
9
+ NDAwMzY5MzNmZWZjZWFiOWQ3ZGMyYzU3ZWRlNjFkYzRhYjY4NzBjMjRlMjlm
10
+ NmQ2Nzg5NDY2Mjk2MTNmMmJlZWNlYzgyZTQ1YjhjNWE4N2UwYTE4ODg0NGU0
11
+ YmRlOTVhNTY3NjE1OTRmMWI3YzI2ZWU5ZDNlOGE1ZmMxMTQ0ODk=
12
12
  data.tar.gz: !binary |-
13
- ZDY3MGEyZmQ2ZTk0MmJhMWViNmI3Y2VlODAxYTAxNWU0YTE0NjUzOWYxYzRh
14
- YzRkM2U2YWQ5ZjQ2MzQ1NWZlYmZiY2RmMzUxMDFkOWNlYjdhNWI5OGI1YmUw
15
- NDk0M2QwMzE3MDA3YjRhYWRkMjBkMWE3ZTQxZmU2Y2MwYzcxNTI=
13
+ M2ViMTY5NjQ2ZmI0YmQ5Yjk2YWRlMWYxY2VmNGU1NjIxYTgxMzhkODYyMGNl
14
+ M2JlNTRmZDdkZmYyNjVmNzYyYjgzZDIyZjZlNDQ5ODA0MDMzOWFjOTRkMTA3
15
+ NDE3YTlkOTlkYzdkMWM0ODMwMDc0NTYwMGE5ZGViMTllZWI1OGE=
@@ -40,8 +40,8 @@ module PseudoCleaner
40
40
 
41
41
  def db_connection=(connection)
42
42
  if Object.const_defined?("ActiveRecord", false) && ActiveRecord.const_defined?("Base", false)
43
- table_is_active_record = connection.class == ActiveRecord::Base
44
- table_super_class = connection.class.superclass if connection.class
43
+ table_is_active_record = connection == ActiveRecord::Base
44
+ table_super_class = connection.superclass if connection
45
45
  while !table_is_active_record && table_super_class
46
46
  table_is_active_record = (table_super_class == ActiveRecord::Base)
47
47
  table_super_class = table_super_class.superclass
@@ -2,7 +2,7 @@ first_test_run = false
2
2
 
3
3
  # I haven't tested this fully yet, but I think that this should work.
4
4
 
5
- Spinach.hooks.before_scenario do |scenario, step_definitions|
5
+ Spinach.hooks.around_scenario do |scenario_data, step_definitions, &block|
6
6
  unless first_test_run
7
7
  first_test_run = true
8
8
  # before tests run...
@@ -16,20 +16,22 @@ Spinach.hooks.before_scenario do |scenario, step_definitions|
16
16
  DatabaseCleaner.strategy = :transaction
17
17
  end
18
18
 
19
- strategy = if scenario.tags.include?("@none")
19
+ strategy = if scenario_data.tags.include?("@none")
20
20
  :none
21
- elsif scenario.tags.include?("@truncation")
21
+ elsif scenario_data.tags.include?("@truncation")
22
22
  :truncation
23
- elsif scenario.tags.include?("@deletion")
23
+ elsif scenario_data.tags.include?("@deletion")
24
24
  :deletion
25
25
  else
26
26
  :pseudo_delete
27
27
  end
28
- PseudoCleaner::MasterCleaner.start_example(scenario, strategy)
29
- end
28
+ PseudoCleaner::MasterCleaner.start_example(scenario_data, strategy)
30
29
 
31
- Spinach.hooks.after_scenario do |scenario, step_definitions|
32
- PseudoCleaner::MasterCleaner.end_example(scenario)
30
+ begin
31
+ block.call
32
+ ensure
33
+ PseudoCleaner::MasterCleaner.end_example(scenario_data)
34
+ end
33
35
  end
34
36
 
35
37
  Spinach.hooks.after_run do |status|
@@ -1,3 +1,3 @@
1
1
  module PseudoCleaner
2
- VERSION = "0.0.33"
2
+ VERSION = "0.0.34"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pseudo_cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33
4
+ version: 0.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - RealNobody