feat: Add Platform APIs (#1456)

This commit is contained in:
Sojan Jose
2021-01-14 20:35:22 +05:30
committed by GitHub
parent 75c2a7cb2f
commit 7542330d61
25 changed files with 688 additions and 20 deletions

View File

@@ -1,8 +1,13 @@
require 'rails_helper'
require Rails.root.join 'spec/models/concerns/access_tokenable_spec.rb'
RSpec.describe AgentBot, type: :model do
describe 'associations' do
it { is_expected.to have_many(:agent_bot_inboxes) }
it { is_expected.to have_many(:inboxes) }
end
describe 'concerns' do
it_behaves_like 'access_tokenable'
end
end

View File

@@ -0,0 +1,9 @@
require 'rails_helper'
shared_examples_for 'access_tokenable' do
let(:obj) { create(described_class.to_s.underscore) }
it 'creates access token on create' do
expect(obj.access_token).not_to eq(nil)
end
end

View File

@@ -0,0 +1,20 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe PlatformAppPermissible do
let!(:platform_app_permissible) { create(:platform_app_permissible) }
context 'with validations' do
it { is_expected.to validate_presence_of(:platform_app) }
end
context 'with associations' do
it { is_expected.to belong_to(:platform_app) }
it { is_expected.to belong_to(:permissible) }
end
describe 'with factories' do
it { expect(platform_app_permissible).present? }
end
end

View File

@@ -0,0 +1,24 @@
# frozen_string_literal: true
require 'rails_helper'
require Rails.root.join 'spec/models/concerns/access_tokenable_spec.rb'
RSpec.describe PlatformApp do
let(:platform_app) { create(:platform_app) }
context 'with validations' do
it { is_expected.to validate_presence_of(:name) }
end
context 'with associations' do
it { is_expected.to have_many(:platform_app_permissibles) }
end
describe 'with concerns' do
it_behaves_like 'access_tokenable'
end
describe 'with factories' do
it { expect(platform_app).present? }
end
end

View File

@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'rails_helper'
require Rails.root.join 'spec/models/concerns/access_tokenable_spec.rb'
RSpec.describe User do
let!(:user) { create(:user) }
@@ -20,6 +21,10 @@ RSpec.describe User do
it { is_expected.to have_many(:events) }
end
describe 'concerns' do
it_behaves_like 'access_tokenable'
end
describe 'pubsub_token' do
before { user.update(name: Faker::Name.name) }