diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index bfc317855..1702df210 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -79,9 +79,3 @@ Rails/OutputSafety:
- 'app/models/message.rb'
- 'app/views/api/v0/articles/show.json.jbuilder'
- 'app/views/articles/feed.rss.builder'
-
-Layout/AlignParameters:
- Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
- Enabled: false
-
diff --git a/app/black_box/black_box.rb b/app/black_box/black_box.rb
index 3e305c002..a2c37383d 100644
--- a/app/black_box/black_box.rb
+++ b/app/black_box/black_box.rb
@@ -12,7 +12,7 @@ class BlackBox
two_day_bonus = usable_date > 48.hours.ago ? 330 : 0
four_day_bonus = usable_date > 96.hours.ago ? 330 : 0
FunctionCaller.new("blackbox-production-articleHotness",
- { article: article, user: article.user }.to_json).call +
+ { article: article, user: article.user }.to_json).call +
reaction_points + recency_bonus + super_recent_bonus + super_super_recent_bonus + today_bonus + two_day_bonus + four_day_bonus
end
@@ -30,7 +30,7 @@ class BlackBox
return 100 unless story.user
FunctionCaller.new("blackbox-production-spamScore",
- { story: story, user: story.user }.to_json).call
+ { story: story, user: story.user }.to_json).call
end
private
diff --git a/app/black_box/google_analytics.rb b/app/black_box/google_analytics.rb
index 7a6947f65..4517d83ab 100644
--- a/app/black_box/google_analytics.rb
+++ b/app/black_box/google_analytics.rb
@@ -26,7 +26,7 @@ class GoogleAnalytics
def get_feed_impression_info
requests = @article_ids.map do |id|
make_report_request("ga:eventAction==featured-feed-impression;ga:eventLabel==articles-#{id}",
- "ga:totalEvents")
+ "ga:totalEvents")
end
results = fetch_all_results(requests)
@article_ids.zip(results).to_h
@@ -35,7 +35,7 @@ class GoogleAnalytics
def get_feed_click_info
requests = @article_ids.map do |id|
make_report_request("ga:eventAction==featured-feed-click;ga:eventLabel==articles-#{id}",
- "ga:totalEvents")
+ "ga:totalEvents")
end
results = fetch_all_results(requests)
@article_ids.zip(results).to_h
diff --git a/app/controllers/api/v0/articles_controller.rb b/app/controllers/api/v0/articles_controller.rb
index 2a71f6018..f3737bcb9 100644
--- a/app/controllers/api/v0/articles_controller.rb
+++ b/app/controllers/api/v0/articles_controller.rb
@@ -3,8 +3,8 @@ module Api
class ArticlesController < ApiController
before_action :set_cache_control_headers, only: [:index]
caches_action :show,
- cache_path: proc { |c| c.params.permit! },
- expires_in: 5.minutes
+ cache_path: proc { |c| c.params.permit! },
+ expires_in: 5.minutes
respond_to :json
before_action :cors_preflight_check
diff --git a/app/controllers/api/v0/comments_controller.rb b/app/controllers/api/v0/comments_controller.rb
index 5c1f2ce4a..c819d546b 100644
--- a/app/controllers/api/v0/comments_controller.rb
+++ b/app/controllers/api/v0/comments_controller.rb
@@ -3,13 +3,13 @@ module Api
class CommentsController < ApplicationController
# before_action :set_cache_control_headers, only: [:index, :show]
caches_action :index,
- cache_path: proc { |c| c.params.permit! },
- expires_in: 10.minutes
+ cache_path: proc { |c| c.params.permit! },
+ expires_in: 10.minutes
respond_to :json
caches_action :show,
- cache_path: proc { |c| c.params.permit! },
- expires_in: 10.minutes
+ cache_path: proc { |c| c.params.permit! },
+ expires_in: 10.minutes
respond_to :json
def index
diff --git a/app/controllers/api/v0/podcast_episodes_controller.rb b/app/controllers/api/v0/podcast_episodes_controller.rb
index d2244039d..37ac4b36d 100644
--- a/app/controllers/api/v0/podcast_episodes_controller.rb
+++ b/app/controllers/api/v0/podcast_episodes_controller.rb
@@ -2,8 +2,8 @@ module Api
module V0
class PodcastEpisodesController < ApiController
caches_action :index,
- cache_path: proc { |c| c.params.permit! },
- expires_in: 10.minutes
+ cache_path: proc { |c| c.params.permit! },
+ expires_in: 10.minutes
respond_to :json
before_action :cors_preflight_check
diff --git a/app/controllers/api/v0/tags_controller.rb b/app/controllers/api/v0/tags_controller.rb
index fe2b4211e..42c8a69bf 100644
--- a/app/controllers/api/v0/tags_controller.rb
+++ b/app/controllers/api/v0/tags_controller.rb
@@ -3,8 +3,8 @@ module Api
class TagsController < ApplicationController
# before_action :set_cache_control_headers, only: [:index]
caches_action :index,
- cache_path: proc { |c| c.params.permit! },
- expires_in: 10.minutes
+ cache_path: proc { |c| c.params.permit! },
+ expires_in: 10.minutes
respond_to :json
def index
diff --git a/app/controllers/api/v0/videos_controller.rb b/app/controllers/api/v0/videos_controller.rb
index ca505b247..7d4aaad47 100644
--- a/app/controllers/api/v0/videos_controller.rb
+++ b/app/controllers/api/v0/videos_controller.rb
@@ -2,8 +2,8 @@ module Api
module V0
class VideosController < ApiController
caches_action :index,
- cache_path: proc { |c| c.params.permit! },
- expires_in: 10.minutes
+ cache_path: proc { |c| c.params.permit! },
+ expires_in: 10.minutes
respond_to :json
before_action :cors_preflight_check
diff --git a/app/controllers/chat_channels_controller.rb b/app/controllers/chat_channels_controller.rb
index fb27924d1..1c3497eef 100644
--- a/app/controllers/chat_channels_controller.rb
+++ b/app/controllers/chat_channels_controller.rb
@@ -132,7 +132,7 @@ class ChatChannelsController < ApplicationController
current_user.
chat_channel_memberships.includes(:chat_channel).
where("has_unopened_messages = ? OR status = ?",
- true, "pending").
+ true, "pending").
where(show_global_badge_notification: true).
order("chat_channel_memberships.updated_at DESC")
else
diff --git a/app/controllers/followed_articles_controller.rb b/app/controllers/followed_articles_controller.rb
index 66fdad98a..103f7d1c2 100644
--- a/app/controllers/followed_articles_controller.rb
+++ b/app/controllers/followed_articles_controller.rb
@@ -2,8 +2,8 @@ class FollowedArticlesController < ApplicationController
# No authorization required for entirely public controller
caches_action :index,
- cache_path: proc { "followed_articles_#{current_user.id}__#{current_user.updated_at}__#{user_signed_in?}" },
- expires_in: 35.minutes
+ cache_path: proc { "followed_articles_#{current_user.id}__#{current_user.updated_at}__#{user_signed_in?}" },
+ expires_in: 35.minutes
def index
@articles = if current_user
diff --git a/app/controllers/github_repos_controller.rb b/app/controllers/github_repos_controller.rb
index de18fe98f..160240085 100644
--- a/app/controllers/github_repos_controller.rb
+++ b/app/controllers/github_repos_controller.rb
@@ -10,7 +10,7 @@ class GithubReposController < ApplicationController
redirect_to "/settings/integrations", notice: "GitHub repo added"
else
redirect_to "/settings/integrations",
- error: "There was an error adding your Github repo"
+ error: "There was an error adding your Github repo"
end
end
@@ -22,7 +22,7 @@ class GithubReposController < ApplicationController
redirect_to "/settings/integrations", notice: "GitHub repo added"
else
redirect_to "/settings/integrations",
- error: "There was an error removing your Github repo"
+ error: "There was an error removing your Github repo"
end
end
diff --git a/app/controllers/internal/events_controller.rb b/app/controllers/internal/events_controller.rb
index 371ed271b..4cd2941ac 100644
--- a/app/controllers/internal/events_controller.rb
+++ b/app/controllers/internal/events_controller.rb
@@ -39,18 +39,18 @@ module Internal
def event_params
params.require(:event).permit(:title,
- :category,
- :event_date,
- :starts_at,
- :ends_at,
- :location_name,
- :cover_image,
- :location_url,
- :description_markdown,
- :published,
- :host_name,
- :profile_image,
- :live_now)
+ :category,
+ :event_date,
+ :starts_at,
+ :ends_at,
+ :location_name,
+ :cover_image,
+ :location_url,
+ :description_markdown,
+ :published,
+ :host_name,
+ :profile_image,
+ :live_now)
end
end
end
diff --git a/app/controllers/internal/users_controller.rb b/app/controllers/internal/users_controller.rb
index 9963a2911..2de04dcc5 100644
--- a/app/controllers/internal/users_controller.rb
+++ b/app/controllers/internal/users_controller.rb
@@ -117,16 +117,16 @@ class Internal::UsersController < Internal::ApplicationController
def user_params
params.require(:user).permit(:seeking_mentorship,
- :offering_mentorship,
- :quick_match,
- :new_note,
- :add_mentor,
- :add_mentee,
- :note_for_current_role,
- :mentorship_note,
- :user_status,
- :toggle_mentorship,
- :pro,
- :merge_user_id)
+ :offering_mentorship,
+ :quick_match,
+ :new_note,
+ :add_mentor,
+ :add_mentee,
+ :note_for_current_role,
+ :mentorship_note,
+ :user_status,
+ :toggle_mentorship,
+ :pro,
+ :merge_user_id)
end
end
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index 725d11603..1f77f0b59 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -12,13 +12,13 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def failure
logger.error "Omniauth failure",
- omniauth_failure: {
- error: request.env["omniauth.error"]&.inspect,
- error_type: request.env["omniauth.error.type"].to_s,
- auth: request.env["omniauth.auth"],
- provider: request.env["omniauth.strategy"].to_s,
- cookie: request.env["rack.request.cookie_hash"]
- }
+ omniauth_failure: {
+ error: request.env["omniauth.error"]&.inspect,
+ error_type: request.env["omniauth.error.type"].to_s,
+ auth: request.env["omniauth.auth"],
+ provider: request.env["omniauth.strategy"].to_s,
+ cookie: request.env["rack.request.cookie_hash"]
+ }
super
end
diff --git a/app/controllers/podcast_episodes_controller.rb b/app/controllers/podcast_episodes_controller.rb
index 470ca7321..38c2db167 100644
--- a/app/controllers/podcast_episodes_controller.rb
+++ b/app/controllers/podcast_episodes_controller.rb
@@ -20,10 +20,10 @@ class PodcastEpisodesController < ApplicationController
def podcast_episode_params
params.require(:podcast_episode).permit(:title,
- :body,
- :image,
- :social_image,
- :remote_social_image_url,
- :quote)
+ :body,
+ :image,
+ :social_image,
+ :remote_social_image_url,
+ :quote)
end
end
diff --git a/app/controllers/pusher_controller.rb b/app/controllers/pusher_controller.rb
index 9bfab6efc..08ae05f61 100644
--- a/app/controllers/pusher_controller.rb
+++ b/app/controllers/pusher_controller.rb
@@ -2,7 +2,7 @@ class PusherController < ApplicationController
def auth
if valid_channel
response = Pusher.authenticate(params[:channel_name], params[:socket_id],
- user_id: current_user.id) # => required
+ user_id: current_user.id) # => required
render json: response
else
render json: { text: "Forbidden", status: "403" }
diff --git a/app/controllers/stripe_active_cards_controller.rb b/app/controllers/stripe_active_cards_controller.rb
index d0b7685d6..1460c26f5 100644
--- a/app/controllers/stripe_active_cards_controller.rb
+++ b/app/controllers/stripe_active_cards_controller.rb
@@ -42,7 +42,7 @@ class StripeActiveCardsController < ApplicationController
customer.sources.retrieve(params[:id]).delete
customer.save
redirect_to "/settings/billing",
- notice: "Your card has been successfully removed."
+ notice: "Your card has been successfully removed."
else
redirect_to "/settings/billing", flash: { error:
"Can't remove card if you have an active membership. Please cancel your membership first." }
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index a2bee18e5..82d4fa6c5 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -66,7 +66,7 @@ class UsersController < ApplicationController
identity_username = "#{provider}_username".to_sym
@user.update(identity_username => nil)
redirect_to "/settings/#{@tab}",
- notice: "Your #{provider.capitalize} account was successfully removed."
+ notice: "Your #{provider.capitalize} account was successfully removed."
else
flash[:error] = "An error occurred. Please try again or send an email to: yo@dev.to"
redirect_to "/settings/#{@tab}"
@@ -93,7 +93,7 @@ class UsersController < ApplicationController
if (@organization = Organization.find_by(secret: params[:org_secret]))
current_user.update(organization_id: @organization.id)
redirect_to "/settings/organization",
- notice: "You have joined the #{@organization.name} organization."
+ notice: "You have joined the #{@organization.name} organization."
else
not_found
end
@@ -103,7 +103,7 @@ class UsersController < ApplicationController
authorize User
current_user.update(organization_id: nil, org_admin: nil)
redirect_to "/settings/organization",
- notice: "You have left your organization."
+ notice: "You have left your organization."
end
def add_org_admin
@@ -112,7 +112,7 @@ class UsersController < ApplicationController
user.update(org_admin: true)
user.add_role :analytics_beta_tester if user.organization.approved
redirect_to "/settings/organization",
- notice: "#{user.name} is now an admin."
+ notice: "#{user.name} is now an admin."
end
def remove_org_admin
@@ -120,7 +120,7 @@ class UsersController < ApplicationController
authorize user
user.update(org_admin: false)
redirect_to "/settings/organization",
- notice: "#{user.name} is no longer an admin."
+ notice: "#{user.name} is no longer an admin."
end
def remove_from_org
@@ -128,7 +128,7 @@ class UsersController < ApplicationController
authorize user
user.update(organization_id: nil)
redirect_to "/settings/organization",
- notice: "#{user.name} is no longer part of your organization."
+ notice: "#{user.name} is no longer part of your organization."
end
def signout_confirm; end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 2eff27368..fb49f7089 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -108,14 +108,14 @@ module ApplicationHelper
quality = "auto"
cl_image_path(url,
- type: "fetch",
- width: width,
- height: height,
- crop: "imagga_scale",
- quality: quality,
- flags: "progressive",
- fetch_format: "auto",
- sign_url: true)
+ type: "fetch",
+ width: width,
+ height: height,
+ crop: "imagga_scale",
+ quality: quality,
+ flags: "progressive",
+ fetch_format: "auto",
+ sign_url: true)
end
def cloud_social_image(article)
@@ -126,14 +126,14 @@ module ApplicationHelper
return src if src.start_with? "https://res.cloudinary.com/"
cl_image_path(src,
- type: "fetch",
- width: "1000",
- height: "500",
- crop: "imagga_scale",
- quality: "auto",
- flags: "progressive",
- fetch_format: "auto",
- sign_url: true)
+ type: "fetch",
+ width: "1000",
+ height: "500",
+ crop: "imagga_scale",
+ quality: "auto",
+ flags: "progressive",
+ fetch_format: "auto",
+ sign_url: true)
end
end
@@ -159,12 +159,12 @@ module ApplicationHelper
def sanitize_rendered_markdown(processed_html)
ActionController::Base.helpers.sanitize processed_html.html_safe,
- scrubber: RenderedMarkdownScrubber.new
+ scrubber: RenderedMarkdownScrubber.new
end
def sanitized_sidebar(text)
ActionController::Base.helpers.sanitize simple_format(text),
- tags: %w[p b i em strike strong u br]
+ tags: %w[p b i em strike strong u br]
end
def track_split_version(url, version)
@@ -173,11 +173,11 @@ module ApplicationHelper
def follow_button(followable, style = "full")
tag :button, # Yikes
- class: "cta follow-action-button",
- data: {
- info: { id: followable.id, className: followable.class.name, style: style }.to_json,
- "follow-action-button" => true
- }
+ class: "cta follow-action-button",
+ data: {
+ info: { id: followable.id, className: followable.class.name, style: style }.to_json,
+ "follow-action-button" => true
+ }
end
def user_colors_style(user)
diff --git a/app/labor/cache_buster.rb b/app/labor/cache_buster.rb
index 64cb1f826..24d3e6893 100644
--- a/app/labor/cache_buster.rb
+++ b/app/labor/cache_buster.rb
@@ -7,9 +7,9 @@ class CacheBuster
return unless Rails.env.production?
HTTParty.post("https://api.fastly.com/purge/https://dev.to#{path}",
- headers: { "Fastly-Key" => ApplicationConfig["FASTLY_API_KEY"] })
+ headers: { "Fastly-Key" => ApplicationConfig["FASTLY_API_KEY"] })
HTTParty.post("https://api.fastly.com/purge/https://dev.to#{path}?i=i",
- headers: { "Fastly-Key" => ApplicationConfig["FASTLY_API_KEY"] })
+ headers: { "Fastly-Key" => ApplicationConfig["FASTLY_API_KEY"] })
end
def bust_comment(commentable, username)
diff --git a/app/labor/coupon_generator.rb b/app/labor/coupon_generator.rb
index 676c1afed..662d1aa34 100644
--- a/app/labor/coupon_generator.rb
+++ b/app/labor/coupon_generator.rb
@@ -14,7 +14,7 @@ class CouponGenerator
def lambda_generated_code
response = FunctionCaller.new("blackbox-production-couponCode",
- { inputNumber: id, version: version }.to_json).call
+ { inputNumber: id, version: version }.to_json).call
response.to_s(36)
end
end
diff --git a/app/labor/email_logic.rb b/app/labor/email_logic.rb
index cc6a1e504..e844b41ca 100644
--- a/app/labor/email_logic.rb
+++ b/app/labor/email_logic.rb
@@ -1,6 +1,6 @@
class EmailLogic
attr_reader :open_percentage, :last_email_sent_at,
- :days_until_next_email, :articles_to_send
+ :days_until_next_email, :articles_to_send
def initialize(user)
@user = user
diff --git a/app/labor/generated_image.rb b/app/labor/generated_image.rb
index 012342865..e570634db 100644
--- a/app/labor/generated_image.rb
+++ b/app/labor/generated_image.rb
@@ -28,11 +28,11 @@ class GeneratedImage
def cloudinary_generated_url(path)
cl_image_path("https://dev.to/social_previews#{path}",
- gravity: "north",
- height: 400,
- width: 800,
- crop: "fill",
- sign_url: true,
- type: "url2png")
+ gravity: "north",
+ height: 400,
+ width: 800,
+ crop: "fill",
+ sign_url: true,
+ type: "url2png")
end
end
diff --git a/app/labor/markdown_parser.rb b/app/labor/markdown_parser.rb
index b112cd2f4..9f4572d87 100644
--- a/app/labor/markdown_parser.rb
+++ b/app/labor/markdown_parser.rb
@@ -42,8 +42,8 @@ class MarkdownParser
br ul ol li small sup sub img a span hr blockquote kbd]
allowed_attributes = %w[href strong em ref rel src title alt class]
ActionController::Base.helpers.sanitize markdown.render(@content).html_safe,
- tags: allowed_tags,
- attributes: allowed_attributes
+ tags: allowed_tags,
+ attributes: allowed_attributes
end
def evaluate_limited_markdown
@@ -54,8 +54,8 @@ class MarkdownParser
allowed_tags = %w[strong i u b em p br code]
allowed_attributes = %w[href strong em ref rel src title alt class]
ActionController::Base.helpers.sanitize markdown.render(@content).html_safe,
- tags: allowed_tags,
- attributes: allowed_attributes
+ tags: allowed_tags,
+ attributes: allowed_attributes
end
def tags_used
@@ -165,13 +165,13 @@ class MarkdownParser
"auto"
end
cl_image_path(source,
- type: "fetch",
- width: width,
- crop: "limit",
- quality: quality,
- flags: "progressive",
- fetch_format: "auto",
- sign_url: true).gsub(",", "%2C")
+ type: "fetch",
+ width: width,
+ crop: "limit",
+ quality: quality,
+ flags: "progressive",
+ fetch_format: "auto",
+ sign_url: true).gsub(",", "%2C")
end
def wrap_all_images_in_links(html)
diff --git a/app/labor/profile_image.rb b/app/labor/profile_image.rb
index 8315f0b92..efcf65375 100644
--- a/app/labor/profile_image.rb
+++ b/app/labor/profile_image.rb
@@ -10,14 +10,14 @@ class ProfileImage
def get(width = 120)
cl_image_path(get_link,
- type: "fetch",
- crop: "fill",
- width: width,
- height: width,
- quality: "auto",
- flags: "progressive",
- fetch_format: "auto",
- sign_url: true)
+ type: "fetch",
+ crop: "fill",
+ width: width,
+ height: width,
+ quality: "auto",
+ flags: "progressive",
+ fetch_format: "auto",
+ sign_url: true)
end
def get_link
diff --git a/app/liquid_tags/gist_tag.rb b/app/liquid_tags/gist_tag.rb
index 0d72c9d52..59a70fc5f 100644
--- a/app/liquid_tags/gist_tag.rb
+++ b/app/liquid_tags/gist_tag.rb
@@ -33,7 +33,7 @@ class GistTag < LiquidTagBase
input_no_space
else
raise StandardError,
- "Invalid Gist link: #{link} Links must follow this format: https://gist.github.com/username/gist_id"
+ "Invalid Gist link: #{link} Links must follow this format: https://gist.github.com/username/gist_id"
end
end
diff --git a/app/liquid_tags/podcast_tag.rb b/app/liquid_tags/podcast_tag.rb
index 304fc158d..c0af868a9 100644
--- a/app/liquid_tags/podcast_tag.rb
+++ b/app/liquid_tags/podcast_tag.rb
@@ -25,13 +25,13 @@ class PodcastTag < LiquidTagBase
#{cl_image_tag(@podcast.image_url,
- type: 'fetch',
- crop: 'fill',
- quality: 'auto',
- sign_url: true,
- flags: 'progressive',
- fetch_format: 'auto',
- class: 'tinyimage')}
+ type: 'fetch',
+ crop: 'fill',
+ quality: 'auto',
+ sign_url: true,
+ flags: 'progressive',
+ fetch_format: 'auto',
+ class: 'tinyimage')}
#{@podcast.title}
@@ -42,14 +42,14 @@ class PodcastTag < LiquidTagBase
#{cl_image_tag(@podcast.image_url,
- type: 'fetch',
- crop: 'fill',
- quality: 'auto',
- sign_url: true,
- flags: 'progressive',
- fetch_format: 'auto',
- class: 'podcastliquidtag__podcastimage',
- id: "podcastimage-#{episode.slug}")}
+ type: 'fetch',
+ crop: 'fill',
+ quality: 'auto',
+ sign_url: true,
+ flags: 'progressive',
+ fetch_format: 'auto',
+ class: 'podcastliquidtag__podcastimage',
+ id: "podcastimage-#{episode.slug}")}
#{render_hidden_audio}
@@ -72,15 +72,15 @@ class PodcastTag < LiquidTagBase
diff --git a/app/models/article.rb b/app/models/article.rb
index 2d1b6c2db..e7afb06e7 100644
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -77,23 +77,23 @@ class Article < ApplicationRecord
scope :limited_column_select, lambda {
select(:path, :title, :id,
- :comments_count, :positive_reactions_count, :cached_tag_list,
- :main_image, :main_image_background_hex_color, :updated_at, :slug,
- :video, :user_id, :organization_id, :video_source_url, :video_code,
- :video_thumbnail_url, :video_closed_caption_track_url, :language,
- :experience_level_rating, :experience_level_rating_distribution,
- :published_at, :crossposted_at, :boost_states, :description, :reading_time, :video_duration_in_seconds)
+ :comments_count, :positive_reactions_count, :cached_tag_list,
+ :main_image, :main_image_background_hex_color, :updated_at, :slug,
+ :video, :user_id, :organization_id, :video_source_url, :video_code,
+ :video_thumbnail_url, :video_closed_caption_track_url, :language,
+ :experience_level_rating, :experience_level_rating_distribution,
+ :published_at, :crossposted_at, :boost_states, :description, :reading_time, :video_duration_in_seconds)
}
scope :limited_columns_internal_select, lambda {
select(:path, :title, :id, :featured, :approved, :published,
- :comments_count, :positive_reactions_count, :cached_tag_list,
- :main_image, :main_image_background_hex_color, :updated_at, :boost_states,
- :video, :user_id, :organization_id, :video_source_url, :video_code,
- :video_thumbnail_url, :video_closed_caption_track_url, :social_image,
- :published_from_feed, :crossposted_at, :published_at, :featured_number,
- :live_now, :last_buffered, :facebook_last_buffered, :created_at, :body_markdown,
- :email_digest_eligible, :processed_html)
+ :comments_count, :positive_reactions_count, :cached_tag_list,
+ :main_image, :main_image_background_hex_color, :updated_at, :boost_states,
+ :video, :user_id, :organization_id, :video_source_url, :video_code,
+ :video_thumbnail_url, :video_closed_caption_track_url, :social_image,
+ :published_from_feed, :crossposted_at, :published_at, :featured_number,
+ :live_now, :last_buffered, :facebook_last_buffered, :created_at, :body_markdown,
+ :email_digest_eligible, :processed_html)
}
scope :boosted_via_additional_articles, lambda {
@@ -107,14 +107,14 @@ class Article < ApplicationRecord
algoliasearch per_environment: true, auto_remove: false, enqueue: :trigger_delayed_index do
attribute :title
add_index "searchables",
- id: :index_id,
- per_environment: true,
- enqueue: :trigger_delayed_index do
+ id: :index_id,
+ per_environment: true,
+ enqueue: :trigger_delayed_index do
attributes :title, :tag_list, :main_image, :id, :reading_time, :score,
- :featured, :published, :published_at, :featured_number,
- :comments_count, :reactions_count, :positive_reactions_count,
- :path, :class_name, :user_name, :user_username, :comments_blob,
- :body_text, :tag_keywords_for_search, :search_score, :readable_publish_date, :flare_tag
+ :featured, :published, :published_at, :featured_number,
+ :comments_count, :reactions_count, :positive_reactions_count,
+ :path, :class_name, :user_name, :user_username, :comments_blob,
+ :body_text, :tag_keywords_for_search, :search_score, :readable_publish_date, :flare_tag
attribute :user do
{ username: user.username,
name: user.name,
@@ -139,12 +139,12 @@ class Article < ApplicationRecord
end
add_index "ordered_articles",
- id: :index_id,
- per_environment: true,
- enqueue: :trigger_delayed_index do
+ id: :index_id,
+ per_environment: true,
+ enqueue: :trigger_delayed_index do
attributes :title, :path, :class_name, :comments_count, :reading_time, :language,
- :tag_list, :positive_reactions_count, :id, :hotness_score, :score, :readable_publish_date, :flare_tag, :user_id,
- :organization_id, :cloudinary_video_url, :video_duration_in_minutes, :experience_level_rating, :experience_level_rating_distribution
+ :tag_list, :positive_reactions_count, :id, :hotness_score, :score, :readable_publish_date, :flare_tag, :user_id,
+ :organization_id, :cloudinary_video_url, :video_duration_in_minutes, :experience_level_rating, :experience_level_rating_distribution
attribute :published_at_int do
published_at.to_i
end
diff --git a/app/models/badge_achievement.rb b/app/models/badge_achievement.rb
index e9427cd94..429bd2599 100644
--- a/app/models/badge_achievement.rb
+++ b/app/models/badge_achievement.rb
@@ -17,8 +17,8 @@ class BadgeAchievement < ApplicationRecord
parsed_markdown = MarkdownParser.new(rewarding_context_message_markdown)
html = parsed_markdown.finalize
final_html = ActionController::Base.helpers.sanitize html,
- tags: %w[strong em i b u a code],
- attributes: %w[href name]
+ tags: %w[strong em i b u a code],
+ attributes: %w[href name]
self.rewarding_context_message = final_html
end
diff --git a/app/models/chat_channel.rb b/app/models/chat_channel.rb
index abb220ce8..0c5ebe299 100644
--- a/app/models/chat_channel.rb
+++ b/app/models/chat_channel.rb
@@ -21,9 +21,9 @@ class ChatChannel < ApplicationRecord
algoliasearch index_name: "SecuredChatChannel_#{Rails.env}" do
attribute :id, :viewable_by, :slug, :channel_type,
- :channel_name, :channel_users, :last_message_at, :status,
- :messages_count, :channel_human_names, :channel_mod_ids, :pending_users_select_fields,
- :description
+ :channel_name, :channel_users, :last_message_at, :status,
+ :messages_count, :channel_human_names, :channel_mod_ids, :pending_users_select_fields,
+ :description
searchableAttributes %i[channel_name channel_slug channel_human_names]
attributesForFaceting ["filterOnly(viewable_by)", "filterOnly(status)", "filterOnly(channel_type)"]
ranking ["desc(last_message_at)"]
diff --git a/app/models/comment.rb b/app/models/comment.rb
index e1cf10ce8..55c802ea4 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -37,14 +37,14 @@ class Comment < ApplicationRecord
algoliasearch per_environment: true, enqueue: :trigger_delayed_index do
attribute :id
add_index "ordered_comments",
- id: :index_id,
- per_environment: true,
- enqueue: :trigger_delayed_index do
+ id: :index_id,
+ per_environment: true,
+ enqueue: :trigger_delayed_index do
attributes :id, :user_id, :commentable_id, :commentable_type, :id_code_generated, :path,
- :id_code, :readable_publish_date, :parent_id, :positive_reactions_count, :created_at
+ :id_code, :readable_publish_date, :parent_id, :positive_reactions_count, :created_at
attribute :body_html do
HTML_Truncator.truncate(processed_html,
- 500, ellipsis: '... Read Entire Comment')
+ 500, ellipsis: '... Read Entire Comment')
end
attribute :url do
path
diff --git a/app/models/display_ad.rb b/app/models/display_ad.rb
index a5c1a5c14..dd815b54d 100644
--- a/app/models/display_ad.rb
+++ b/app/models/display_ad.rb
@@ -13,8 +13,8 @@ class DisplayAd < ApplicationRecord
markdown = Redcarpet::Markdown.new(renderer)
initial_html = markdown.render(body_markdown)
stripped_html = ActionController::Base.helpers.sanitize initial_html.html_safe,
- tags: %w[a em i b u br img h1 h2 h3 h4 div],
- attributes: %w[href target src height width style]
+ tags: %w[a em i b u br img h1 h2 h3 h4 div],
+ attributes: %w[href target src height width style]
html = stripped_html.delete("\n")
self.processed_html = MarkdownParser.new(html).prefix_all_images(html, 350)
end
diff --git a/app/models/html_variant.rb b/app/models/html_variant.rb
index f4439b926..a3685026b 100644
--- a/app/models/html_variant.rb
+++ b/app/models/html_variant.rb
@@ -77,12 +77,12 @@ class HtmlVariant < ApplicationRecord
"auto"
end
cl_image_path(source,
- type: "fetch",
- width: width,
- crop: "limit",
- quality: quality,
- flags: "progressive",
- fetch_format: "auto",
- sign_url: true).gsub(",", "%2C")
+ type: "fetch",
+ width: width,
+ crop: "limit",
+ quality: quality,
+ flags: "progressive",
+ fetch_format: "auto",
+ sign_url: true).gsub(",", "%2C")
end
end
diff --git a/app/models/job_opportunity.rb b/app/models/job_opportunity.rb
index e543e4057..52bdfd4ab 100644
--- a/app/models/job_opportunity.rb
+++ b/app/models/job_opportunity.rb
@@ -1,7 +1,7 @@
class JobOpportunity < ApplicationRecord
has_many :articles
validates :remoteness,
- inclusion: { in: %w[on_premise fully_remote remote_optional on_premise_flexible] }
+ inclusion: { in: %w[on_premise fully_remote remote_optional on_premise_flexible] }
def remoteness_in_words
phrases = {
"on_premise" => "In Office",
diff --git a/app/models/organization.rb b/app/models/organization.rb
index e91ece2ab..0dea0e620 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -36,7 +36,7 @@ class Organization < ApplicationRecord
allow_blank: true }
validates :tech_stack, :story, length: { maximum: 640 }
validates :cta_button_url,
- url: { allow_blank: true, no_local: true, schemes: %w[https http] }
+ url: { allow_blank: true, no_local: true, schemes: %w[https http] }
validates :cta_button_text, length: { maximum: 20 }
validates :cta_body_markdown, length: { maximum: 256 }
before_save :remove_at_from_usernames
diff --git a/app/models/podcast_episode.rb b/app/models/podcast_episode.rb
index eea82731c..e52179b25 100644
--- a/app/models/podcast_episode.rb
+++ b/app/models/podcast_episode.rb
@@ -28,13 +28,13 @@ class PodcastEpisode < ApplicationRecord
algoliasearch per_environment: true do
attribute :id
add_index "searchables",
- id: :index_id,
- per_environment: true do
+ id: :index_id,
+ per_environment: true do
attribute :title, :body, :quote, :summary, :subtitle, :website_url,
- :published_at, :comments_count, :path, :class_name,
- :user_name, :user_username, :published, :comments_blob,
- :body_text, :tag_list, :tag_keywords_for_search,
- :positive_reactions_count, :search_score
+ :published_at, :comments_count, :path, :class_name,
+ :user_name, :user_username, :published, :comments_blob,
+ :body_text, :tag_list, :tag_keywords_for_search,
+ :positive_reactions_count, :search_score
attribute :user do
{ name: podcast.name,
username: user_username,
@@ -168,13 +168,13 @@ class PodcastEpisode < ApplicationRecord
cloudinary_img_src = ActionController::Base.helpers.
cl_image_path(img_src,
- type: "fetch",
- width: 725,
- crop: "limit",
- quality: quality,
- flags: "progressive",
- fetch_format: "auto",
- sign_url: true)
+ type: "fetch",
+ width: 725,
+ crop: "limit",
+ quality: quality,
+ flags: "progressive",
+ fetch_format: "auto",
+ sign_url: true)
self.processed_html = processed_html.gsub(img_src, cloudinary_img_src)
end
end
diff --git a/app/models/reaction.rb b/app/models/reaction.rb
index aabbf8b38..0a775fe0a 100644
--- a/app/models/reaction.rb
+++ b/app/models/reaction.rb
@@ -5,9 +5,9 @@ class Reaction < ApplicationRecord
belongs_to :user
counter_culture :reactable,
- column_name: proc { |model|
- model.points.positive? ? "positive_reactions_count" : "reactions_count"
- }
+ column_name: proc { |model|
+ model.points.positive? ? "positive_reactions_count" : "reactions_count"
+ }
counter_culture :user
validates :category, inclusion: { in: CATEGORIES }
diff --git a/app/models/tag.rb b/app/models/tag.rb
index eba6ffcb2..676a04aae 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -19,9 +19,9 @@ class Tag < ActsAsTaggableOn::Tag
mount_uploader :social_image, ProfileImageUploader
validates :text_color_hex,
- format: /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, allow_nil: true
+ format: /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, allow_nil: true
validates :bg_color_hex,
- format: /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, allow_nil: true
+ format: /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, allow_nil: true
validate :validate_alias
before_validation :evaluate_markdown
diff --git a/app/models/user.rb b/app/models/user.rb
index 68126983d..2ea9c2c5e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -37,20 +37,20 @@ class User < ApplicationRecord
has_many :html_variants, dependent: :destroy
has_many :page_views
has_many :mentor_relationships_as_mentee,
- class_name: "MentorRelationship", foreign_key: "mentee_id", inverse_of: :mentee
+ class_name: "MentorRelationship", foreign_key: "mentee_id", inverse_of: :mentee
has_many :mentor_relationships_as_mentor,
- class_name: "MentorRelationship", foreign_key: "mentor_id", inverse_of: :mentor
+ class_name: "MentorRelationship", foreign_key: "mentor_id", inverse_of: :mentor
has_many :mentors,
- through: :mentor_relationships_as_mentee,
- source: :mentor
+ through: :mentor_relationships_as_mentee,
+ source: :mentor
has_many :mentees,
- through: :mentor_relationships_as_mentor,
- source: :mentee
+ through: :mentor_relationships_as_mentor,
+ source: :mentee
mount_uploader :profile_image, ProfileImageUploader
devise :omniauthable, :rememberable,
- :registerable, :database_authenticatable, :confirmable
+ :registerable, :database_authenticatable, :confirmable
validates :email,
uniqueness: { allow_blank: true, case_sensitive: false },
length: { maximum: 50 },
@@ -70,64 +70,64 @@ class User < ApplicationRecord
validates :text_color_hex, format: /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, allow_blank: true
validates :bg_color_hex, format: /\A#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, allow_blank: true
validates :website_url, :employer_url, :mastodon_url,
- url: { allow_blank: true, no_local: true, schemes: %w[https http] }
+ url: { allow_blank: true, no_local: true, schemes: %w[https http] }
validates :facebook_url,
- format: /\A(http(s)?:\/\/)?(www.facebook.com|facebook.com)\/.*\Z/,
- allow_blank: true
+ format: /\A(http(s)?:\/\/)?(www.facebook.com|facebook.com)\/.*\Z/,
+ allow_blank: true
validates :stackoverflow_url,
- allow_blank: true,
- format:
- /\A(http(s)?:\/\/)?(www.stackoverflow.com|stackoverflow.com|www.stackexchange.com|stackexchange.com)\/.*\Z/
+ allow_blank: true,
+ format:
+ /\A(http(s)?:\/\/)?(www.stackoverflow.com|stackoverflow.com|www.stackexchange.com|stackexchange.com)\/.*\Z/
validates :behance_url,
- allow_blank: true,
- format: /\A(http(s)?:\/\/)?(www.behance.net|behance.net)\/.*\Z/
+ allow_blank: true,
+ format: /\A(http(s)?:\/\/)?(www.behance.net|behance.net)\/.*\Z/
validates :linkedin_url,
- allow_blank: true,
- format:
- /\A(http(s)?:\/\/)?(www.linkedin.com|linkedin.com|[A-Za-z]{2}.linkedin.com)\/.*\Z/
+ allow_blank: true,
+ format:
+ /\A(http(s)?:\/\/)?(www.linkedin.com|linkedin.com|[A-Za-z]{2}.linkedin.com)\/.*\Z/
validates :dribbble_url,
- allow_blank: true,
- format: /\A(http(s)?:\/\/)?(www.dribbble.com|dribbble.com)\/.*\Z/
+ allow_blank: true,
+ format: /\A(http(s)?:\/\/)?(www.dribbble.com|dribbble.com)\/.*\Z/
validates :medium_url,
- allow_blank: true,
- format: /\A(http(s)?:\/\/)?(www.medium.com|medium.com)\/.*\Z/
+ allow_blank: true,
+ format: /\A(http(s)?:\/\/)?(www.medium.com|medium.com)\/.*\Z/
validates :gitlab_url,
- allow_blank: true,
- format: /\A(http(s)?:\/\/)?(www.gitlab.com|gitlab.com)\/.*\Z/
+ allow_blank: true,
+ format: /\A(http(s)?:\/\/)?(www.gitlab.com|gitlab.com)\/.*\Z/
validates :shirt_gender,
- inclusion: { in: %w[unisex womens],
- message: "%{value} is not a valid shirt style" },
- allow_blank: true
+ inclusion: { in: %w[unisex womens],
+ message: "%{value} is not a valid shirt style" },
+ allow_blank: true
validates :shirt_size,
- inclusion: { in: %w[xs s m l xl 2xl 3xl 4xl],
- message: "%{value} is not a valid size" },
- allow_blank: true
+ inclusion: { in: %w[xs s m l xl 2xl 3xl 4xl],
+ message: "%{value} is not a valid size" },
+ allow_blank: true
validates :tabs_or_spaces,
- inclusion: { in: %w[tabs spaces],
- message: "%{value} is not a valid answer" },
- allow_blank: true
+ inclusion: { in: %w[tabs spaces],
+ message: "%{value} is not a valid answer" },
+ allow_blank: true
validates :editor_version,
- inclusion: { in: %w[v1 v2],
- message: "%{value} must be either v1 or v2" }
+ inclusion: { in: %w[v1 v2],
+ message: "%{value} must be either v1 or v2" }
validates :config_theme,
- inclusion: { in: %w[default night_theme],
- message: "%{value} must be either default or night theme" }
+ inclusion: { in: %w[default night_theme],
+ message: "%{value} must be either default or night theme" }
validates :config_font,
- inclusion: { in: %w[default sans_serif comic_sans],
- message: "%{value} must be either default or sans serif" }
+ inclusion: { in: %w[default sans_serif comic_sans],
+ message: "%{value} must be either default or sans serif" }
validates :shipping_country,
- length: { in: 2..2 },
- allow_blank: true
+ length: { in: 2..2 },
+ allow_blank: true
validates :website_url, :employer_name, :employer_url,
- length: { maximum: 100 }
+ length: { maximum: 100 }
validates :employment_title, :education, :location,
- length: { maximum: 100 }
+ length: { maximum: 100 }
validates :mostly_work_with, :currently_learning,
:currently_hacking_on, :available_for,
- length: { maximum: 500 }
+ length: { maximum: 500 }
validates :mentee_description, :mentor_description,
- length: { maximum: 1000 }
+ length: { maximum: 1000 }
validates :inbox_type, inclusion: { in: %w[open private] }
validate :conditionally_validate_summary
validate :validate_mastodon_url
@@ -156,19 +156,19 @@ class User < ApplicationRecord
algoliasearch per_environment: true, enqueue: :trigger_delayed_index do
attribute :name
add_index "searchables",
- id: :index_id,
- per_environment: true,
- enqueue: :trigger_delayed_index do
+ id: :index_id,
+ per_environment: true,
+ enqueue: :trigger_delayed_index do
attribute :user do
{ username: user.username,
name: user.username,
profile_image_90: profile_image_90 }
end
attribute :title, :path, :tag_list, :main_image, :id,
- :featured, :published, :published_at, :featured_number, :comments_count,
- :reactions_count, :positive_reactions_count, :class_name, :user_name,
- :user_username, :comments_blob, :body_text, :tag_keywords_for_search,
- :search_score, :hotness_score
+ :featured, :published, :published_at, :featured_number, :comments_count,
+ :reactions_count, :positive_reactions_count, :class_name, :user_name,
+ :user_username, :comments_blob, :body_text, :tag_keywords_for_search,
+ :search_score, :hotness_score
searchableAttributes ["unordered(title)",
"body_text",
"tag_list",
diff --git a/app/observers/application_observer.rb b/app/observers/application_observer.rb
index 25290598c..4d44d2726 100644
--- a/app/observers/application_observer.rb
+++ b/app/observers/application_observer.rb
@@ -3,8 +3,8 @@ class ApplicationObserver < ActiveRecord::Observer
return unless activity.user.warned == true
SlackBot.delay.ping "@#{activity.user.username} just posted.\nThey've been warned since #{activity.user.roles.where(name: 'warned')[0].updated_at.strftime('%d %B %Y')}\nhttps://dev.to#{activity.path}",
- channel: "warned-user-activity",
- username: "sloan_watch_bot",
- icon_emoji: ":sloan:"
+ channel: "warned-user-activity",
+ username: "sloan_watch_bot",
+ icon_emoji: ":sloan:"
end
end
diff --git a/app/observers/article_observer.rb b/app/observers/article_observer.rb
index 4af187e47..f1bac64e1 100644
--- a/app/observers/article_observer.rb
+++ b/app/observers/article_observer.rb
@@ -4,9 +4,9 @@ class ArticleObserver < ApplicationObserver
if article.published && article.published_at > 30.seconds.ago
SlackBot.delay.ping "New Article Published: #{article.title}\nhttps://dev.to#{article.path}",
- channel: "activity",
- username: "article_bot",
- icon_emoji: ":writing_hand:"
+ channel: "activity",
+ username: "article_bot",
+ icon_emoji: ":writing_hand:"
end
warned_user_ping(article)
diff --git a/app/views/articles/feed.rss.builder b/app/views/articles/feed.rss.builder
index bd61d00aa..08d12b19c 100644
--- a/app/views/articles/feed.rss.builder
+++ b/app/views/articles/feed.rss.builder
@@ -17,8 +17,8 @@ xml.rss version: "2.0" do
xml.link "https://dev.to#{article.path}"
xml.guid "https://dev.to#{article.path}"
xml.description sanitize article.processed_html.html_safe,
- tags: %w[strong em a table tbody thead tfoot th tr td col colgroup del p h1 h2 h3 h4 h5 h6 blockquote iframe time div span i em u b ul ol li dd dl dt q code pre img sup cite center br small],
- attributes: %w[href strong em class ref rel src title alt colspan height width size rowspan span value start data-conversation data-lang id]
+ tags: %w[strong em a table tbody thead tfoot th tr td col colgroup del p h1 h2 h3 h4 h5 h6 blockquote iframe time div span i em u b ul ol li dd dl dt q code pre img sup cite center br small],
+ attributes: %w[href strong em class ref rel src title alt colspan height width size rowspan span value start data-conversation data-lang id]
end
end
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index a00d66969..385866925 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -123,5 +123,5 @@ Rails.application.configure do
}
config.middleware.use Rack::HostRedirect,
- "practicaldev.herokuapp.com" => "dev.to"
+ "practicaldev.herokuapp.com" => "dev.to"
end
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 65fd1b3e4..d51d549da 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -262,6 +262,6 @@ Devise.setup do |config|
# config.omniauth_path_prefix = '/my_engine/users/auth'
config.omniauth :github,
- ApplicationConfig["GITHUB_KEY"], ApplicationConfig["GITHUB_SECRET"], scope: "user:email"
+ ApplicationConfig["GITHUB_KEY"], ApplicationConfig["GITHUB_SECRET"], scope: "user:email"
config.omniauth :twitter, ApplicationConfig["TWITTER_KEY"], ApplicationConfig["TWITTER_SECRET"]
end
diff --git a/config/initializers/serviceworker.rb b/config/initializers/serviceworker.rb
index a2d1d6d98..f80a7b12c 100644
--- a/config/initializers/serviceworker.rb
+++ b/config/initializers/serviceworker.rb
@@ -2,9 +2,9 @@ Rails.application.configure do
config.serviceworker.routes.draw do
# map to assets implicitly
match "/serviceworker.js",
- headers: { "Cache-Control" => "public, max-age=8000, s-max-age=20000, no-cache" }
+ headers: { "Cache-Control" => "public, max-age=8000, s-max-age=20000, no-cache" }
match "/manifest.json",
- headers: { "Cache-Control" => "public, max-age=8000, s-max-age=20000, no-cache" }
+ headers: { "Cache-Control" => "public, max-age=8000, s-max-age=20000, no-cache" }
# Examples
#
# map to a named asset explicitly
diff --git a/spec/requests/article_mutes_spec.rb b/spec/requests/article_mutes_spec.rb
index 930d5bf00..08df2e014 100644
--- a/spec/requests/article_mutes_spec.rb
+++ b/spec/requests/article_mutes_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe "ArticleMutes", type: :request do
it "returns 302 upon success" do
article = create(:article, user: user)
patch "/article_mutes/#{article.id}",
- params: { article: { receive_notifications: false } }
+ params: { article: { receive_notifications: false } }
expect(response).to have_http_status(:found)
end
end
diff --git a/spec/requests/buffer_updates_spec.rb b/spec/requests/buffer_updates_spec.rb
index 01e9486ba..c85496f33 100644
--- a/spec/requests/buffer_updates_spec.rb
+++ b/spec/requests/buffer_updates_spec.rb
@@ -14,8 +14,8 @@ RSpec.describe "BufferUpdates", type: :request do
it "creates buffer update for tweet if tweet params are passed" do
post "/buffer_updates",
- params:
- { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
+ params:
+ { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
expect(BufferUpdate.all.size).to eq(2)
expect(BufferUpdate.last.body_text).to start_with("This is the text!!!!")
expect(BufferUpdate.last.status).to eq("pending")
@@ -23,15 +23,15 @@ RSpec.describe "BufferUpdates", type: :request do
it "creates buffer update with link" do
post "/buffer_updates",
- params:
- { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
+ params:
+ { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
expect(BufferUpdate.first.body_text).to include(article.path)
end
it "creates buffer hashtag" do
post "/buffer_updates",
- params:
- { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
+ params:
+ { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
expect(BufferUpdate.first.body_text).to include("#DEVCommunity")
end
@@ -40,8 +40,8 @@ RSpec.describe "BufferUpdates", type: :request do
create(:tag, name: "rails")
tag = create(:tag, buffer_profile_id_code: "placeholder", name: "ruby")
post "/buffer_updates",
- params:
- { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
+ params:
+ { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
expect(BufferUpdate.all.size).to eq(3)
expect(BufferUpdate.second.tag_id).to eq(tag.id)
expect(BufferUpdate.last.social_service_name).to eq("facebook")
@@ -57,8 +57,8 @@ RSpec.describe "BufferUpdates", type: :request do
it "rejects buffer update for non-trusted user" do
expect do
post "/buffer_updates",
- params:
- { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
+ params:
+ { buffer_update: { body_text: "This is the text!!!!", tag_id: "javascript", article_id: article.id } }
end.to raise_error(Pundit::NotAuthorizedError)
end
end
diff --git a/spec/requests/chat_channels_spec.rb b/spec/requests/chat_channels_spec.rb
index 2b2a3d7fc..d2e6dceea 100644
--- a/spec/requests/chat_channels_spec.rb
+++ b/spec/requests/chat_channels_spec.rb
@@ -98,8 +98,8 @@ RSpec.describe "ChatChannels", type: :request do
describe "POST /chat_channels" do
it "creates chat_channel for current user" do
post "/chat_channels",
- params: { chat_channel: { channel_name: "Hello Channel", slug: "hello-channel" } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { chat_channel: { channel_name: "Hello Channel", slug: "hello-channel" } },
+ headers: { HTTP_ACCEPT: "application/json" }
expect(ChatChannel.last.slug).to eq("hello-channel")
expect(ChatChannel.last.active_users).to include(user)
end
@@ -107,8 +107,8 @@ RSpec.describe "ChatChannels", type: :request do
it "returns errors if channel is invalid" do
# slug should be taken
post "/chat_channels",
- params: { chat_channel: { channel_name: "HEy hey hoho", slug: chat_channel.slug } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { chat_channel: { channel_name: "HEy hey hoho", slug: chat_channel.slug } },
+ headers: { HTTP_ACCEPT: "application/json" }
expect(response.body).to include("Slug has already been taken")
end
end
@@ -117,23 +117,23 @@ RSpec.describe "ChatChannels", type: :request do
it "updates channel for valid user" do
user.add_role(:super_admin)
put "/chat_channels/#{chat_channel.id}",
- params: { chat_channel: { channel_name: "Hello Channel", slug: "hello-channelly" } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { chat_channel: { channel_name: "Hello Channel", slug: "hello-channelly" } },
+ headers: { HTTP_ACCEPT: "application/json" }
expect(ChatChannel.last.slug).to eq("hello-channelly")
end
it "dissallows invalid users" do
expect do
put "/chat_channels/#{chat_channel.id}",
- params: { chat_channel: { channel_name: "Hello Channel", slug: "hello-channelly" } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { chat_channel: { channel_name: "Hello Channel", slug: "hello-channelly" } },
+ headers: { HTTP_ACCEPT: "application/json" }
end.to raise_error(Pundit::NotAuthorizedError)
end
it "returns errors if channel is invalid" do
# slug should be taken
user.add_role(:super_admin)
put "/chat_channels/#{chat_channel.id}",
- params: { chat_channel: { channel_name: "HEy hey hoho", slug: invite_channel.slug } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { chat_channel: { channel_name: "HEy hey hoho", slug: invite_channel.slug } },
+ headers: { HTTP_ACCEPT: "application/json" }
expect(response.body).to include("Slug has already been taken")
end
end
@@ -142,8 +142,8 @@ RSpec.describe "ChatChannels", type: :request do
it "raises NotAuthorizedError if user is not logged in" do
expect do
post "/chat_channels/#{chat_channel.id}/moderate",
- params: { chat_channel: { command: "/ban huh" } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { chat_channel: { command: "/ban huh" } },
+ headers: { HTTP_ACCEPT: "application/json" }
end.to raise_error(Pundit::NotAuthorizedError)
end
@@ -151,8 +151,8 @@ RSpec.describe "ChatChannels", type: :request do
sign_in user
expect do
post "/chat_channels/#{chat_channel.id}/moderate",
- params: { chat_channel: { command: "/ban huh" } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { chat_channel: { command: "/ban huh" } },
+ headers: { HTTP_ACCEPT: "application/json" }
end.to raise_error(Pundit::NotAuthorizedError)
end
@@ -165,13 +165,13 @@ RSpec.describe "ChatChannels", type: :request do
it "enforces chat_channel_params on ban" do
post "/chat_channels/#{chat_channel.id}/moderate",
- params: { chat_channel: { command: "/ban #{test_subject.username}" } }
+ params: { chat_channel: { command: "/ban #{test_subject.username}" } }
expect(response.status).to eq(200)
end
it "enforces chat_channel_params on unban" do
post "/chat_channels/#{chat_channel.id}/moderate",
- params: { chat_channel: { command: "/unban #{test_subject.username}" } }
+ params: { chat_channel: { command: "/unban #{test_subject.username}" } }
expect(response.status).to eq(200)
end
end
@@ -192,19 +192,19 @@ RSpec.describe "ChatChannels", type: :request do
describe "POST /chat_channels/create_chat" do
it "creates open chat with user who has open inbox" do
post "/chat_channels/create_chat",
- params: { user_id: user_open_inbox.id }
+ params: { user_id: user_open_inbox.id }
expect(response.status).to eq(200)
end
it "does not create for non-open inbox user" do
post "/chat_channels/create_chat",
- params: { user_id: user_closed_inbox.id }
+ params: { user_id: user_closed_inbox.id }
expect(response.status).to eq(400)
end
it "creates ensures new chat channel is created for targeted user" do
post "/chat_channels/create_chat",
- params: { user_id: user_open_inbox.id }
+ params: { user_id: user_open_inbox.id }
expect(user_open_inbox.chat_channel_memberships.size).to eq(1)
end
end
@@ -213,13 +213,13 @@ RSpec.describe "ChatChannels", type: :request do
it "blocks successfully when user has permissions" do
direct_channel.add_users [user]
post "/chat_channels/block_chat",
- params: { chat_id: direct_channel.id }
+ params: { chat_id: direct_channel.id }
expect(response.status).to eq(200)
end
it "makes chat channel have status of blocked" do
direct_channel.add_users [user]
post "/chat_channels/block_chat",
- params: { chat_id: direct_channel.id }
+ params: { chat_id: direct_channel.id }
expect(direct_channel.reload.status).to eq("blocked")
end
it "does not block when channel is open" do
diff --git a/spec/requests/comments_spec.rb b/spec/requests/comments_spec.rb
index fefb4aaa2..fb27976aa 100644
--- a/spec/requests/comments_spec.rb
+++ b/spec/requests/comments_spec.rb
@@ -78,8 +78,8 @@ RSpec.describe "Comments", type: :request do
describe "POST /comments/preview" do
it "returns 401 if user is not logged in" do
post "/comments/preview",
- params: { comment: { body_markdown: "hi" } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { comment: { body_markdown: "hi" } },
+ headers: { HTTP_ACCEPT: "application/json" }
expect(response).to have_http_status(:unauthorized)
end
@@ -87,8 +87,8 @@ RSpec.describe "Comments", type: :request do
before do
login_as user
post "/comments/preview",
- params: { comment: { body_markdown: "hi" } },
- headers: { HTTP_ACCEPT: "application/json" }
+ params: { comment: { body_markdown: "hi" } },
+ headers: { HTTP_ACCEPT: "application/json" }
end
it "returns 200 on good request" do
diff --git a/spec/requests/follows_update_spec.rb b/spec/requests/follows_update_spec.rb
index 369847f41..a51ea3945 100644
--- a/spec/requests/follows_update_spec.rb
+++ b/spec/requests/follows_update_spec.rb
@@ -13,7 +13,7 @@ RSpec.describe "Following/Unfollowing", type: :request do
it "updates user to offer mentorship" do
user.follow(tag)
put "/follows/#{Follow.last.id}",
- params: { follow: { points: 3.0 } }
+ params: { follow: { points: 3.0 } }
expect(Follow.last.points).to eq(3.0)
end
@@ -21,7 +21,7 @@ RSpec.describe "Following/Unfollowing", type: :request do
user_2.follow(tag)
expect do
put "/follows/#{Follow.last.id}",
- params: { follow: { points: 3.0 } }
+ params: { follow: { points: 3.0 } }
end.to raise_error(Pundit::NotAuthorizedError)
end
end
diff --git a/spec/requests/internal_buffer_updates_spec.rb b/spec/requests/internal_buffer_updates_spec.rb
index 444a38fb8..a78d719c8 100644
--- a/spec/requests/internal_buffer_updates_spec.rb
+++ b/spec/requests/internal_buffer_updates_spec.rb
@@ -13,33 +13,33 @@ RSpec.describe "InternalBufferUpdates", type: :request do
describe "POST /internal/buffer_updates" do
it "creates buffer update for tweet if tweet params are passed" do
post "/internal/buffer_updates",
- params:
- { social_channel: "main_twitter", article_id: article.id, tweet: "Hello this is a test" }
+ params:
+ { social_channel: "main_twitter", article_id: article.id, tweet: "Hello this is a test" }
expect(BufferUpdate.all.size).to eq(1)
post "/internal/buffer_updates",
- params: { social_channel: "main_twitter", article_id: article.id, tweet: "Hello this is a test!" }
+ params: { social_channel: "main_twitter", article_id: article.id, tweet: "Hello this is a test!" }
expect(BufferUpdate.all.size).to eq(2)
expect(BufferUpdate.last.article_id).to eq(article.id)
end
it "updates last buffered at" do
post "/internal/buffer_updates",
- params:
- { social_channel: "main_twitter", article_id: article.id, tweet: "Hello this is a test" }
+ params:
+ { social_channel: "main_twitter", article_id: article.id, tweet: "Hello this is a test" }
expect(article.reload.last_buffered).not_to eq(nil)
end
it "updates last buffered at with satellite buffer" do
post "/internal/buffer_updates",
- params:
- { social_channel: "satellite_twitter", article_id: article.id, tweet: "Hello this is a test" }
+ params:
+ { social_channel: "satellite_twitter", article_id: article.id, tweet: "Hello this is a test" }
expect(article.reload.last_buffered).not_to eq(nil)
end
it "updates last facebook buffered at" do
post "/internal/buffer_updates",
- params:
- { social_channel: "facebook", article_id: article.id, tweet: "Hello this is a test" }
+ params:
+ { social_channel: "facebook", article_id: article.id, tweet: "Hello this is a test" }
expect(article.reload.facebook_last_buffered).not_to eq(nil)
end
end
diff --git a/spec/requests/video_states_update_spec.rb b/spec/requests/video_states_update_spec.rb
index 532fa277f..9c1ebf966 100644
--- a/spec/requests/video_states_update_spec.rb
+++ b/spec/requests/video_states_update_spec.rb
@@ -10,13 +10,13 @@ RSpec.describe "VideoStatesUpdate", type: :request do
it "updates video state" do
input = JSON.unparse(input: { key: article.video_code })
post "/video_states?key=#{authorized_user.secret}",
- params: { Message: input }.to_json
+ params: { Message: input }.to_json
expect(Article.last.video_state).to eq("COMPLETED")
end
it "rejects non-authorized users" do
post "/video_states?key=#{regular_user.secret}",
- params: { input: { key: article.video_code } }
+ params: { input: { key: article.video_code } }
expect(response).to have_http_status(:unprocessable_entity)
end
end
diff --git a/spec/support/initializers/capybara.rb b/spec/support/initializers/capybara.rb
index 48de985e6..4bd1fbe9d 100644
--- a/spec/support/initializers/capybara.rb
+++ b/spec/support/initializers/capybara.rb
@@ -6,10 +6,10 @@ Capybara.default_max_wait_time = 5
Capybara.register_driver :headless_chrome do |app|
Capybara::Selenium::Driver.new app,
- browser: :chrome,
- desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
- chromeOptions: { args: %w[headless disable-gpu no-sandbox window-size=1400,2000] },
- )
+ browser: :chrome,
+ desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
+ chromeOptions: { args: %w[headless disable-gpu no-sandbox window-size=1400,2000] },
+ )
end
RSpec.configure do |config|