Added some model tests
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
25
spec/models/hardware_model_spec.rb
Normal file
25
spec/models/hardware_model_spec.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../spec_helper'
|
||||
|
||||
RSpec.describe(Hardware) do
|
||||
describe 'Hardware Creation' do
|
||||
it 'Hardware creation updates model count.' do
|
||||
expect{ Hardware.create(name: 'Test Hardware', type: 'gpu') }.to(change { Hardware.count }.by(1))
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Hardware Read' do
|
||||
before { Hardware.create(name: 'Test Hardware', type: 'gpu') }
|
||||
|
||||
it 'Hardware model has name.' do
|
||||
hardware = Hardware.first()
|
||||
expect(hardware.name).to(eq('Test Hardware'))
|
||||
end
|
||||
|
||||
it 'Hardware model has scoring.' do
|
||||
hardware = Hardware.first()
|
||||
expect(hardware.type).to(eq('gpu'))
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user