Add heartbeat model, next_heartbeat_time and update_heartbeat_time on device registration

This commit is contained in:
leenasn
2015-11-09 13:43:21 +05:30
parent 185b10d8e7
commit 0e8b403142
11 changed files with 89 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
require 'rails_helper'
RSpec.describe Heartbeat, type: :model do
let(:heartbeat){create(:heartbeat)}
it "update device heartbeat details" do
device = heartbeat.device
expect(device.last_heartbeat_recd_time).to eq(heartbeat.created_at)
expect(device.heartbeats_count).to eq(1)
end
it "next heartbeat" do
expect(heartbeat.next_heartbeat_time).not_to be_nil
end
end