From 17b34f5744eb0cf5f59ad4e443e667520f6dc396 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Mon, 29 Apr 2019 16:56:51 +1000 Subject: [PATCH] DEV: correct heisentest This test failed IF this category id number 3 was fabricated to start with at the top of the test. This is very likely if the test is run on a blank DB --- .../admin/embeddable_hosts_controller_spec.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/requests/admin/embeddable_hosts_controller_spec.rb b/spec/requests/admin/embeddable_hosts_controller_spec.rb index 3f90af83fd1..fc7353a66fc 100644 --- a/spec/requests/admin/embeddable_hosts_controller_spec.rb +++ b/spec/requests/admin/embeddable_hosts_controller_spec.rb @@ -27,22 +27,22 @@ describe Admin::EmbeddableHostsController do describe '#update' do it "logs embeddable host update" do + + category = Fabricate(:category) + put "/admin/embeddable_hosts/#{embeddable_host.id}.json", params: { - embeddable_host: { host: "test.com", class_name: "test-class", category_id: "3" } + embeddable_host: { host: "test.com", class_name: "test-class", category_id: category.id } } expect(response.status).to eq(200) - if (!UserHistory.where( + history_exists = 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?) + new_value: "host: test.com, class_name: test-class, category_id: #{category.id}").exists? + + expect(history_exists).to eq(true) - 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