Refactor:Remove Unused BufferedArticles Controller (#11193)
This commit is contained in:
parent
c0168df2a8
commit
9cf92d1a9e
4 changed files with 0 additions and 47 deletions
|
|
@ -1,21 +0,0 @@
|
|||
class BufferedArticlesController < ApplicationController
|
||||
# No authorization required for entirely public controller
|
||||
|
||||
def index
|
||||
render json: { urls: buffered_articles_urls }.to_json
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def buffered_articles_urls
|
||||
relation = if Rails.env.production?
|
||||
Article.where("last_buffered > ?", 24.hours.ago)
|
||||
.or(Article.where("published_at > ?", 20.minutes.ago))
|
||||
else
|
||||
Article.all
|
||||
end
|
||||
|
||||
paths = relation.pluck(:path)
|
||||
paths.map { |path| URL.url(path) }
|
||||
end
|
||||
end
|
||||
|
|
@ -26,7 +26,6 @@ class ReservedWords
|
|||
bit
|
||||
bits
|
||||
blocks
|
||||
buffered_articles
|
||||
butt
|
||||
byte
|
||||
bytes
|
||||
|
|
|
|||
|
|
@ -256,7 +256,6 @@ Rails.application.routes.draw do
|
|||
post "/update_or_create", to: "github_repos#update_or_create"
|
||||
end
|
||||
end
|
||||
resources :buffered_articles, only: [:index]
|
||||
resources :events, only: %i[index show]
|
||||
resources :videos, only: %i[index create new]
|
||||
resources :video_states, only: [:create]
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "BufferedArticles", type: :request do
|
||||
describe "GET /buffered_articles" do
|
||||
it "works successfully" do
|
||||
get buffered_articles_path
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
|
||||
it "responds with json" do
|
||||
get buffered_articles_path
|
||||
|
||||
expect(response.media_type).to eq("application/json")
|
||||
end
|
||||
|
||||
it "responds with at least one url" do
|
||||
article = create(:article)
|
||||
|
||||
get buffered_articles_path
|
||||
expect(response.parsed_body["urls"].first).to eq(article.decorate.url)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue