DEV: add diagnostics to erratic test

approved
#1

DEV: add diagnostics to erratic test

diff --git a/spec/requests/admin/embeddable_hosts_controller_spec.rb b/spec/requests/admin/embeddable_hosts_controller_spec.rb
index f0b2d65..3f90af8 100644
--- a/spec/requests/admin/embeddable_hosts_controller_spec.rb
+++ b/spec/requests/admin/embeddable_hosts_controller_spec.rb
@@ -32,9 +32,17 @@ describe Admin::EmbeddableHostsController do
         }
 
         expect(response.status).to eq(200)
-        expect(UserHistory.where(acting_user_id: admin.id,
-                                 action: UserHistory.actions[:embeddable_host_update],
-                                 new_value: "host: test.com, class_name: test-class, category_id: 3").exists?).to eq(true)
+
+        if (!UserHistory.where(
+            acting_user_id: admin.id,
+            action: UserHistory.actions[:embeddable_host_update],
+            new_value: "host: test.com, class_name: test-class, category_id: 3").exists?)
+
+          puts "heisentest just failed, debug info is:"
+          puts "count: #{UserHistory.count}"
+          puts "data: #{UserHistory.all.map(&:to_json).join("\n")}"
+          expect("erracit test").to eq("erratic test")
+        end
       end
     end

GitHub sha: 8ca73235

1 Like
Approved #2