diff --git a/app/models/custom_button.rb b/app/models/custom_button.rb index 293a6e48bf8..b0eb0e82523 100644 --- a/app/models/custom_button.rb +++ b/app/models/custom_button.rb @@ -105,6 +105,7 @@ def publish_event(source, target, args) :user_id => args[:user_id], :group_id => args[:miq_group_id], :tenant_id => args[:tenant_id], + :timestamp => Time.now.utc, :full_data => { :args => args, :automate_entry_point => resource_action.ae_path, diff --git a/spec/models/custom_button_spec.rb b/spec/models/custom_button_spec.rb index ec06a141f0b..ab415d812a3 100644 --- a/spec/models/custom_button_spec.rb +++ b/spec/models/custom_button_spec.rb @@ -306,7 +306,10 @@ %i(invoke invoke_async).each do |method| describe "##{method}" do it "publishes CustomButtonEvent" do - User.with_user(user) { custom_button.send(method, vm, 'UI') } + Timecop.freeze(Time.now.utc) do + User.with_user(user) { custom_button.send(method, vm, 'UI') } + expect(CustomButtonEvent.first.timestamp).to be_within(0.01).of(Time.now.utc) + end expect(CustomButtonEvent.count).to eq(1) expect(CustomButtonEvent.first).to have_attributes(