@@ -8,17 +8,20 @@ class TestNotifications < LinkedData::TestCase
88 include EmailSpec ::Helpers
99
1010 def self . before_suite
11- @@notifications_enabled = LinkedData . settings . enable_notifications
12- @@disable_override = LinkedData . settings . email_disable_override
13- @@old_support_mails = LinkedData . settings . ontoportal_admin_emails
14- if @@old_support_mails . nil? || @@old_support_mails . empty?
15- LinkedData . settings . ontoportal_admin_emails = [ 'ontoportal-support@mail.com' ]
16- end
11+ # Store original settings
12+ @original_settings = {
13+ notifications_enabled : LinkedData . settings . enable_notifications ,
14+ disable_override : LinkedData . settings . email_disable_override ,
15+ admin_emails : LinkedData . settings . ontoportal_admin_emails
16+ }
17+
1718 LinkedData . settings . email_disable_override = true
1819 LinkedData . settings . enable_notifications = true
20+ LinkedData . settings . ontoportal_admin_emails = [ 'ontoportal-support@mail.com' ]
21+
1922 @@ui_name = LinkedData . settings . ui_name
2023 @@support_mails = LinkedData . settings . ontoportal_admin_emails
21- @@ont = LinkedData ::SampleData ::Ontology . create_ontologies_and_submissions ( ont_count : 1 ,
24+ @@ont = LinkedData ::SampleData ::Ontology . create_ontologies_and_submissions ( ont_count : 1 ,
2225 submission_count : 1 ) [ 2 ] . first
2326 @@ont . bring_remaining
2427 @@user = @@ont . administeredBy . first
@@ -29,12 +32,12 @@ def self.before_suite
2932 end
3033
3134 def self . after_suite
32- LinkedData . settings . enable_notifications = @@notifications_enabled
33- LinkedData . settings . email_disable_override = @@disable_override
34- LinkedData . settings . ontoportal_admin_emails = @@old_support_mails
35- @@ont . delete if defined? ( @@ont )
36- @@subscription . delete if defined? ( @@subscription )
37- @@user . delete if defined? ( @@user )
35+ # Restore original settings
36+ LinkedData . settings . enable_notifications = @original_settings [ :notifications_enabled ]
37+ LinkedData . settings . email_disable_override = @original_settings [ :disable_override ]
38+ LinkedData . settings . ontoportal_admin_emails = @original_settings [ :admin_emails ]
39+
40+ [ @@ont , @@subscription , @@user ] . each ( & :delete )
3841 end
3942
4043 def setup
0 commit comments