From ad585fb1959abe38839c30137cf3343737f1d247 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Sat, 4 Mar 2023 11:12:54 -0500 Subject: Specs api v1 controllers (#23930) --- .../canonical_email_blocks_controller_spec.rb | 23 ++++++++++++++++++++++ .../api/v1/admin/dimensions_controller_spec.rb | 23 ++++++++++++++++++++++ .../admin/email_domain_blocks_controller_spec.rb | 23 ++++++++++++++++++++++ .../api/v1/admin/ip_blocks_controller_spec.rb | 23 ++++++++++++++++++++++ .../api/v1/admin/measures_controller_spec.rb | 23 ++++++++++++++++++++++ .../api/v1/admin/retention_controller_spec.rb | 23 ++++++++++++++++++++++ .../api/v1/admin/trends/links_controller_spec.rb | 23 ++++++++++++++++++++++ .../v1/admin/trends/statuses_controller_spec.rb | 23 ++++++++++++++++++++++ .../api/v1/admin/trends/tags_controller_spec.rb | 23 ++++++++++++++++++++++ 9 files changed, 207 insertions(+) create mode 100644 spec/controllers/api/v1/admin/canonical_email_blocks_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/dimensions_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/email_domain_blocks_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/ip_blocks_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/measures_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/retention_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/trends/links_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/trends/statuses_controller_spec.rb create mode 100644 spec/controllers/api/v1/admin/trends/tags_controller_spec.rb (limited to 'spec/controllers/api/v1/admin') diff --git a/spec/controllers/api/v1/admin/canonical_email_blocks_controller_spec.rb b/spec/controllers/api/v1/admin/canonical_email_blocks_controller_spec.rb new file mode 100644 index 000000000..3acae843a --- /dev/null +++ b/spec/controllers/api/v1/admin/canonical_email_blocks_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::CanonicalEmailBlocksController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'GET #index' do + it 'returns http success' do + get :index, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/dimensions_controller_spec.rb b/spec/controllers/api/v1/admin/dimensions_controller_spec.rb new file mode 100644 index 000000000..ea18efe38 --- /dev/null +++ b/spec/controllers/api/v1/admin/dimensions_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::DimensionsController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'POST #create' do + it 'returns http success' do + post :create, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/email_domain_blocks_controller_spec.rb b/spec/controllers/api/v1/admin/email_domain_blocks_controller_spec.rb new file mode 100644 index 000000000..a92a29869 --- /dev/null +++ b/spec/controllers/api/v1/admin/email_domain_blocks_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::EmailDomainBlocksController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'GET #index' do + it 'returns http success' do + get :index, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/ip_blocks_controller_spec.rb b/spec/controllers/api/v1/admin/ip_blocks_controller_spec.rb new file mode 100644 index 000000000..50e2ae968 --- /dev/null +++ b/spec/controllers/api/v1/admin/ip_blocks_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::IpBlocksController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'GET #index' do + it 'returns http success' do + get :index, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/measures_controller_spec.rb b/spec/controllers/api/v1/admin/measures_controller_spec.rb new file mode 100644 index 000000000..03727a632 --- /dev/null +++ b/spec/controllers/api/v1/admin/measures_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::MeasuresController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'POST #create' do + it 'returns http success' do + post :create, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/retention_controller_spec.rb b/spec/controllers/api/v1/admin/retention_controller_spec.rb new file mode 100644 index 000000000..2381dbcb4 --- /dev/null +++ b/spec/controllers/api/v1/admin/retention_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::RetentionController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'POST #create' do + it 'returns http success' do + post :create, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/trends/links_controller_spec.rb b/spec/controllers/api/v1/admin/trends/links_controller_spec.rb new file mode 100644 index 000000000..a64292f06 --- /dev/null +++ b/spec/controllers/api/v1/admin/trends/links_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::Trends::LinksController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'GET #index' do + it 'returns http success' do + get :index, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/trends/statuses_controller_spec.rb b/spec/controllers/api/v1/admin/trends/statuses_controller_spec.rb new file mode 100644 index 000000000..821cc499f --- /dev/null +++ b/spec/controllers/api/v1/admin/trends/statuses_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::Trends::StatusesController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'GET #index' do + it 'returns http success' do + get :index, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end diff --git a/spec/controllers/api/v1/admin/trends/tags_controller_spec.rb b/spec/controllers/api/v1/admin/trends/tags_controller_spec.rb new file mode 100644 index 000000000..480306ce7 --- /dev/null +++ b/spec/controllers/api/v1/admin/trends/tags_controller_spec.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe Api::V1::Admin::Trends::TagsController do + render_views + + let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'admin:read') } + let(:account) { Fabricate(:account) } + + before do + allow(controller).to receive(:doorkeeper_token) { token } + end + + describe 'GET #index' do + it 'returns http success' do + get :index, params: { account_id: account.id, limit: 2 } + + expect(response).to have_http_status(200) + end + end +end -- cgit