Initial commit
This commit is contained in:
31
spec/models/zoom_user_spec.rb
Normal file
31
spec/models/zoom_user_spec.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ZoomUser, type: :model do
|
||||
describe 'associations' do
|
||||
it { is_expected.to have_many(:zoom_meetings).dependent(:nullify) }
|
||||
end
|
||||
|
||||
describe 'callbacks' do
|
||||
let(:zoom_user) { build(:zoom_user) }
|
||||
|
||||
context '#after_create' do
|
||||
it 'triggers create_api_user' do
|
||||
allow(zoom_user).to receive(:create_api_user)
|
||||
|
||||
zoom_user.run_callbacks(:create)
|
||||
expect(zoom_user).to have_received(:create_api_user)
|
||||
end
|
||||
|
||||
it 'assigns api_id' do
|
||||
allow_any_instance_of(ZoomGateway).to receive(:create_host).and_return("retrieved_api_id")
|
||||
|
||||
zoom_user.save
|
||||
expect(zoom_user.api_id).to eq "retrieved_api_id"
|
||||
end
|
||||
end
|
||||
|
||||
context '#before_destroy' do
|
||||
pending 'aborts if there is api_id assigned'
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user