feat: Added Instagram channel migration (#11181)
This PR is part of https://github.com/chatwoot/chatwoot/pull/11054 to make the review cycle easier.
This commit is contained in:
13
spec/factories/channel/channel_instagram.rb
Normal file
13
spec/factories/channel/channel_instagram.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
FactoryBot.define do
|
||||
factory :channel_instagram, class: 'Channel::Instagram' do
|
||||
account
|
||||
access_token { SecureRandom.hex(32) }
|
||||
instagram_id { SecureRandom.hex(16) }
|
||||
expires_at { 60.days.from_now }
|
||||
updated_at { 25.hours.ago }
|
||||
|
||||
after(:create) do |channel|
|
||||
create(:inbox, channel: channel, account: channel.account)
|
||||
end
|
||||
end
|
||||
end
|
||||
17
spec/models/channel/instagram_spec.rb
Normal file
17
spec/models/channel/instagram_spec.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Channel::Instagram do
|
||||
let(:channel) { create(:channel_instagram) }
|
||||
|
||||
it { is_expected.to validate_presence_of(:account_id) }
|
||||
it { is_expected.to validate_presence_of(:access_token) }
|
||||
it { is_expected.to validate_presence_of(:instagram_id) }
|
||||
it { is_expected.to belong_to(:account) }
|
||||
it { is_expected.to have_one(:inbox).dependent(:destroy_async) }
|
||||
|
||||
it 'has a valid name' do
|
||||
expect(channel.name).to eq('Instagram')
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user