Fix rubocop lints (#794)
This commit is contained in:
parent
a57c520501
commit
33db32e5f4
79 changed files with 308 additions and 164 deletions
13
.rubocop.yml
13
.rubocop.yml
|
|
@ -3,8 +3,9 @@ inherit_from: .rubocop_todo.yml
|
|||
require: rubocop-rspec
|
||||
|
||||
# our custom config
|
||||
# TODO: Uncomment it after fix rubocop-todo RSpec/MultipleExpectations
|
||||
RSpec/MultipleExpectations:
|
||||
Max: 1
|
||||
# Max: 1
|
||||
Exclude:
|
||||
- "spec/features/*"
|
||||
|
||||
|
|
@ -13,9 +14,10 @@ RSpec/DescribeClass:
|
|||
- spec/features/*
|
||||
- spec/requests/*
|
||||
|
||||
Metrics/LineLength:
|
||||
Description: 'Limit lines to 100 characters.'
|
||||
Max: 100
|
||||
# TODO: Uncomment it after fix rubocop-todo Metrics/LineLength
|
||||
# Metrics/LineLength:
|
||||
# Description: 'Limit lines to 100 characters.'
|
||||
# Max: 100
|
||||
|
||||
#############################
|
||||
|
||||
|
|
@ -117,9 +119,10 @@ Metrics/AbcSize:
|
|||
branches, and conditions.
|
||||
Enabled: false
|
||||
|
||||
# TODO: Uncomment it after fix rubocop-todo Metrics/BlockLength
|
||||
Metrics/BlockLength:
|
||||
CountComments: false # count full line comments?
|
||||
Max: 25
|
||||
# Max: 25
|
||||
ExcludedMethods: []
|
||||
Exclude:
|
||||
- "spec/**/*"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,99 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2018-09-03 23:17:57 +0900 using RuboCop version 0.58.2.
|
||||
# on 2018-10-02 23:35:16 +0300 using RuboCop version 0.59.2.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 104
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLineAfterGuardClause:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLines:
|
||||
Exclude:
|
||||
- 'app/models/buffer_update.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, no_empty_lines
|
||||
Layout/EmptyLinesAroundBlockBody:
|
||||
Exclude:
|
||||
- 'config/routes.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
||||
Layout/EmptyLinesAroundClassBody:
|
||||
Exclude:
|
||||
- 'app/models/buffer_update.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
||||
Layout/ExtraSpacing:
|
||||
Exclude:
|
||||
- 'app/models/article.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: normal, rails
|
||||
Layout/IndentationConsistency:
|
||||
Exclude:
|
||||
- 'app/observers/organization_observer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Layout/LeadingCommentSpace:
|
||||
Exclude:
|
||||
- 'app/controllers/stories_controller.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: aligned, indented, indented_relative_to_receiver
|
||||
Layout/MultilineMethodCallIndentation:
|
||||
Exclude:
|
||||
- 'app/models/follow.rb'
|
||||
- 'app/models/message.rb'
|
||||
|
||||
# Offense count: 14
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: aligned, indented
|
||||
Layout/MultilineOperationIndentation:
|
||||
Exclude:
|
||||
- 'app/models/message.rb'
|
||||
- 'app/models/user.rb'
|
||||
- 'app/services/membership_service.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Layout/RescueEnsureAlignment:
|
||||
Exclude:
|
||||
- 'app/services/user_role_service.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: space, no_space
|
||||
Layout/SpaceAroundEqualsInParameterDefault:
|
||||
Exclude:
|
||||
- 'app/models/buffer_update.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
Exclude:
|
||||
- 'app/mailers/notify_mailer.rb'
|
||||
|
||||
# Offense count: 4
|
||||
Lint/IneffectiveAccessModifier:
|
||||
Exclude:
|
||||
|
|
@ -19,45 +107,55 @@ Lint/UselessAccessModifier:
|
|||
- 'app/black_box/black_box.rb'
|
||||
- 'app/models/tweet.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Offense count: 7
|
||||
# Configuration parameters: CountComments, ExcludedMethods.
|
||||
# ExcludedMethods: refine
|
||||
Metrics/BlockLength:
|
||||
Max: 68
|
||||
|
||||
# Offense count: 108
|
||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Metrics/LineLength:
|
||||
Max: 274
|
||||
Max: 62
|
||||
|
||||
# Offense count: 13
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 13
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 1
|
||||
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
||||
# AllowedNames: io, id, to, by, on, in, at, ip
|
||||
# AllowedNames: io, id, to, by, on, in, at, ip, db
|
||||
Naming/UncommunicativeMethodParamName:
|
||||
Exclude:
|
||||
- 'app/controllers/followed_articles_controller.rb'
|
||||
- 'app/labor/mailchimp_bot.rb'
|
||||
- 'app/labor/podcast_feed.rb'
|
||||
- 'app/models/chat_channel.rb'
|
||||
- 'app/models/message.rb'
|
||||
- 'app/models/tweet.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 5
|
||||
# Configuration parameters: Max.
|
||||
RSpec/ExampleLength:
|
||||
Exclude:
|
||||
- 'spec/models/buffer_update_spec.rb'
|
||||
- 'spec/models/message_spec.rb'
|
||||
- 'spec/requests/analytics_spec.rb'
|
||||
- 'spec/requests/internal_buffer_updates_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Offense count: 13
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: single_line_only, disallow
|
||||
RSpec/ImplicitSubject:
|
||||
Exclude:
|
||||
- 'spec/models/feedback_message_spec.rb'
|
||||
- 'spec/policies/comment_policy_spec.rb'
|
||||
- 'spec/policies/organization_policy_spec.rb'
|
||||
- 'spec/policies/user_policy_spec.rb'
|
||||
- 'spec/requests/dashboard_spec.rb'
|
||||
- 'spec/requests/registration_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Configuration parameters: AggregateFailuresByDefault.
|
||||
RSpec/MultipleExpectations:
|
||||
Max: 6
|
||||
|
||||
# Offense count: 2
|
||||
RSpec/RepeatedDescription:
|
||||
Exclude:
|
||||
- 'spec/models/buffer_update_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
Security/Open:
|
||||
Exclude:
|
||||
|
|
@ -94,3 +192,46 @@ Style/EvalWithLocation:
|
|||
Style/MixinUsage:
|
||||
Exclude:
|
||||
- 'app/models/podcast_episode.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Style/MutableConstant:
|
||||
Exclude:
|
||||
- 'spec/support/omniauth_macros.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
||||
# SupportedStyles: predicate, comparison
|
||||
Style/NumericPredicate:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'app/controllers/stories_controller.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Style/RedundantSelf:
|
||||
Exclude:
|
||||
- 'app/models/buffer_update.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
||||
# SupportedStyles: single_quotes, double_quotes
|
||||
Style/StringLiterals:
|
||||
Exclude:
|
||||
- 'spec/models/buffer_update_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, MinSize.
|
||||
# SupportedStyles: percent, brackets
|
||||
Style/SymbolArray:
|
||||
Exclude:
|
||||
- 'config/routes.rb'
|
||||
|
||||
# Offense count: 972
|
||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||
# URISchemes: http, https
|
||||
Metrics/LineLength:
|
||||
Max: 274
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ rspec_options = {
|
|||
cmd: "bin/spring rspec -p",
|
||||
#############################
|
||||
failed_mode: :focus,
|
||||
bundler_env: :clean_env,
|
||||
bundler_env: :clean_env
|
||||
}
|
||||
|
||||
guard :rspec, rspec_options do
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class AsyncInfoController < ApplicationController
|
|||
unless user_signed_in?
|
||||
render json: {
|
||||
param: request_forgery_protection_token,
|
||||
token: form_authenticity_token,
|
||||
token: form_authenticity_token
|
||||
}
|
||||
return
|
||||
end
|
||||
|
|
@ -22,7 +22,7 @@ class AsyncInfoController < ApplicationController
|
|||
render json: {
|
||||
param: request_forgery_protection_token,
|
||||
token: form_authenticity_token,
|
||||
user: user_data.to_json,
|
||||
user: user_data.to_json
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -44,7 +44,7 @@ class AsyncInfoController < ApplicationController
|
|||
checked_code_of_conduct: @user.checked_code_of_conduct,
|
||||
number_of_comments: @user.comments.count,
|
||||
display_sponsors: @user.display_sponsors,
|
||||
trusted: @user.trusted,
|
||||
trusted: @user.trusted
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ class BufferedArticlesController < ApplicationController
|
|||
def index
|
||||
@article_urls = buffered_article_urls
|
||||
render json: {
|
||||
urls: @article_urls,
|
||||
urls: @article_urls
|
||||
}.to_json
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class CommentsController < ApplicationController
|
|||
name: current_user.name,
|
||||
profile_pic: ProfileImage.new(current_user).get(50),
|
||||
twitter_username: current_user.twitter_username,
|
||||
github_username: current_user.github_username,
|
||||
github_username: current_user.github_username
|
||||
} }
|
||||
elsif @comment = Comment.where(body_markdown: @comment.body_markdown,
|
||||
commentable_id: @comment.commentable.id,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class EmailSubscriptionsController < ApplicationController
|
|||
email_follower_notifications: "follower notifications",
|
||||
email_mention_notifications: "mention notifications",
|
||||
email_connect_messages: "connect messages",
|
||||
email_unread_notifications: "unread notifications",
|
||||
email_unread_notifications: "unread notifications"
|
||||
}
|
||||
emails_type[given_email_type]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class FollowedArticlesController < ApplicationController
|
|||
response.headers["Cache-Control"] = "public, max-age=150"
|
||||
render json: {
|
||||
articles: @articles,
|
||||
classic_article: (article_json(classic_article) if classic_article),
|
||||
classic_article: (article_json(classic_article) if classic_article)
|
||||
}.to_json
|
||||
end
|
||||
|
||||
|
|
@ -55,9 +55,9 @@ class FollowedArticlesController < ApplicationController
|
|||
user: {
|
||||
name: article.user.name,
|
||||
username: article.user.username,
|
||||
profile_image_90: ProfileImage.new(article.user).get(90),
|
||||
profile_image_90: ProfileImage.new(article.user).get(90)
|
||||
},
|
||||
flare_tag: FlareTag.new(article).tag_hash,
|
||||
flare_tag: FlareTag.new(article).tag_hash
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class GithubReposController < ApplicationController
|
|||
watchers_count: fetched_repo.watchers,
|
||||
stargazers_count: fetched_repo.stargazers_count,
|
||||
featured: true,
|
||||
info_hash: fetched_repo.to_hash,
|
||||
info_hash: fetched_repo.to_hash
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ class LiveArticlesController < ApplicationController
|
|||
tag_list: [],
|
||||
user: {
|
||||
name: @event.host_name,
|
||||
profile_pic: ProfileImage.new(@event).get(50),
|
||||
},
|
||||
profile_pic: ProfileImage.new(@event).get(50)
|
||||
}
|
||||
}
|
||||
elsif @article
|
||||
set_surrogate_key_header "live--article_#{@article.id}"
|
||||
|
|
@ -26,8 +26,8 @@ class LiveArticlesController < ApplicationController
|
|||
tag_list: @article.tag_list,
|
||||
user: {
|
||||
name: @article.user.name,
|
||||
profile_pic: ProfileImage.new(@article.user).get(50),
|
||||
},
|
||||
profile_pic: ProfileImage.new(@article.user).get(50)
|
||||
}
|
||||
}
|
||||
else
|
||||
set_surrogate_key_header "live--nothing"
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ class MessagesController < ApplicationController
|
|||
message: {
|
||||
chat_channel_id: @message.chat_channel_id,
|
||||
message: @message.errors.full_messages,
|
||||
type: "error",
|
||||
},
|
||||
type: "error"
|
||||
}
|
||||
}, status: 401
|
||||
end
|
||||
end
|
||||
|
|
@ -49,7 +49,7 @@ class MessagesController < ApplicationController
|
|||
message: new_message.message_html,
|
||||
timestamp: Time.now,
|
||||
color: new_message.preferred_user_color,
|
||||
reception_method: "pushed",
|
||||
reception_method: "pushed"
|
||||
}.to_json
|
||||
end
|
||||
|
||||
|
|
@ -65,8 +65,8 @@ class MessagesController < ApplicationController
|
|||
message: {
|
||||
chat_channel_id: message_params[:chat_channel_id],
|
||||
message: "You can not do that because you are banned",
|
||||
type: "error",
|
||||
},
|
||||
type: "error"
|
||||
}
|
||||
}, status: 401
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class ArticleDashboard < Administrate::BaseDashboard
|
|||
video_source_url: Field::String,
|
||||
video_thumbnail_url: Field::String,
|
||||
video_closed_caption_track_url: Field::String,
|
||||
main_tag_name_for_social: Field::String,
|
||||
main_tag_name_for_social: Field::String
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class BadgeAchievementDashboard < Administrate::BaseDashboard
|
|||
id: Field::Number,
|
||||
rewarder_id: UserIdField,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
updated_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class BadgeDashboard < Administrate::BaseDashboard
|
|||
description: Field::String,
|
||||
badge_image: CarrierwaveField,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
updated_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class CollectionDashboard < Administrate::BaseDashboard
|
|||
social_image: Field::String,
|
||||
published: Field::Boolean,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
updated_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class CommentDashboard < Administrate::BaseDashboard
|
|||
ancestry: Field::String,
|
||||
id_code: Field::String,
|
||||
score: Field::Number,
|
||||
deleted: Field::Boolean,
|
||||
deleted: Field::Boolean
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class DisplayAdDashboard < Administrate::BaseDashboard
|
|||
published: Field::Boolean,
|
||||
approved: Field::Boolean,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
updated_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class EmailMessageDashboard < Administrate::BaseDashboard
|
|||
utm_campaign: Field::String,
|
||||
sent_at: Field::DateTime,
|
||||
opened_at: Field::DateTime,
|
||||
clicked_at: Field::DateTime,
|
||||
clicked_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class FeedbackMessageDashboard < Administrate::BaseDashboard
|
|||
id: Field::Number,
|
||||
message: Field::Text,
|
||||
feedback_type: Field::String,
|
||||
category: Field::String,
|
||||
category: Field::String
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class FollowDashboard < Administrate::BaseDashboard
|
|||
id: Field::Number,
|
||||
blocked: Field::Boolean,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
updated_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class OrganizationDashboard < Administrate::BaseDashboard
|
|||
approved: Field::Boolean,
|
||||
cta_button_text: Field::String,
|
||||
cta_button_url: Field::String,
|
||||
cta_body_markdown: Field::Text,
|
||||
cta_body_markdown: Field::Text
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class PodcastDashboard < Administrate::BaseDashboard
|
|||
slug: Field::String,
|
||||
status_notice: Field::Text,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
updated_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class PodcastEpisodeDashboard < Administrate::BaseDashboard
|
|||
guid: Field::String,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
social_image: CarrierwaveField,
|
||||
social_image: CarrierwaveField
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class ReactionDashboard < Administrate::BaseDashboard
|
|||
category: Field::String,
|
||||
points: Field::Number.with_options(decimals: 2),
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
updated_at: Field::DateTime
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class TagDashboard < Administrate::BaseDashboard
|
|||
alias_for: Field::String,
|
||||
keywords_for_search: Field::String,
|
||||
taggings_count: Field::Number,
|
||||
buffer_profile_id_code: Field::String,
|
||||
buffer_profile_id_code: Field::String
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class UserDashboard < Administrate::BaseDashboard
|
|||
saw_onboarding: Field::Boolean,
|
||||
following_tags_count: Field::Number,
|
||||
monthly_dues: Field::Number,
|
||||
stripe_id_code: Field::String,
|
||||
stripe_id_code: Field::String
|
||||
}.freeze
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ class OrganizationDecorator < ApplicationDecorator
|
|||
if bg_color_hex.blank?
|
||||
{
|
||||
bg: assigned_color[:bg],
|
||||
text: assigned_color[:text],
|
||||
text: assigned_color[:text]
|
||||
}
|
||||
else
|
||||
{
|
||||
bg: bg_color_hex || assigned_color[:bg],
|
||||
text: text_color_hex || assigned_color[:text],
|
||||
text: text_color_hex || assigned_color[:text]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -22,7 +22,7 @@ class OrganizationDecorator < ApplicationDecorator
|
|||
def assigned_color
|
||||
{
|
||||
bg: "#0a0a0a",
|
||||
text: "#ffffff",
|
||||
text: "#ffffff"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ class UserDecorator < ApplicationDecorator
|
|||
if bg_color_hex.blank?
|
||||
{
|
||||
bg: assigned_color[:bg],
|
||||
text: assigned_color[:text],
|
||||
text: assigned_color[:text]
|
||||
}
|
||||
else
|
||||
{
|
||||
bg: bg_color_hex || assigned_color[:bg],
|
||||
text: text_color_hex || assigned_color[:text],
|
||||
text: text_color_hex || assigned_color[:text]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
@ -29,43 +29,43 @@ class UserDecorator < ApplicationDecorator
|
|||
colors = [
|
||||
{
|
||||
bg: "#093656",
|
||||
text: "#ffffff",
|
||||
text: "#ffffff"
|
||||
},
|
||||
{
|
||||
bg: "#19063A",
|
||||
text: "#dce9f3",
|
||||
text: "#dce9f3"
|
||||
},
|
||||
{
|
||||
bg: "#0D4D4B",
|
||||
text: "#fdf9f3",
|
||||
text: "#fdf9f3"
|
||||
},
|
||||
{
|
||||
bg: "#61122f",
|
||||
text: "#ffffff",
|
||||
text: "#ffffff"
|
||||
},
|
||||
{
|
||||
bg: "#edebf6",
|
||||
text: " #070126",
|
||||
text: " #070126"
|
||||
},
|
||||
{
|
||||
bg: "#080E3B",
|
||||
text: "#ffffff",
|
||||
text: "#ffffff"
|
||||
},
|
||||
{
|
||||
bg: "#010C1F",
|
||||
text: "#aebcd5",
|
||||
text: "#aebcd5"
|
||||
},
|
||||
{
|
||||
bg: "#d7dee2",
|
||||
text: "#022235",
|
||||
text: "#022235"
|
||||
},
|
||||
{
|
||||
bg: "#161616",
|
||||
text: "#66e2d5",
|
||||
text: "#66e2d5"
|
||||
},
|
||||
{
|
||||
bg: "#1c0bba",
|
||||
text: "#c9d2dd",
|
||||
text: "#c9d2dd"
|
||||
},
|
||||
]
|
||||
colors[id % 10]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module FeedbackMessagesHelper
|
|||
HEREDOC
|
||||
{
|
||||
subject: "dev.to Status Update",
|
||||
body: body,
|
||||
body: body
|
||||
}.freeze
|
||||
end
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ module FeedbackMessagesHelper
|
|||
HEREDOC
|
||||
{
|
||||
subject: "dev.to Status Update",
|
||||
body: body,
|
||||
body: body
|
||||
}.freeze
|
||||
end
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ module FeedbackMessagesHelper
|
|||
HEREDOC
|
||||
{
|
||||
subject: "Courtesy Notice from dev.to",
|
||||
body: body,
|
||||
body: body
|
||||
}.freeze
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class ColorFromImage
|
|||
|
||||
def get_palette
|
||||
input = {
|
||||
url: @url,
|
||||
url: @url
|
||||
}
|
||||
client = Algorithmia.client(ApplicationConfig["ALGORITHMIA_KEY"])
|
||||
algo = client.algo("vagrant/ColorSchemeExtraction/0.2.0")
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class MailchimpBot
|
|||
EXPERIENCE: user.experience_level || 666,
|
||||
COUNTRY: user.shipping_country.to_s,
|
||||
STATE: user.shipping_state.to_s,
|
||||
POSTAL_ZIP: user.shipping_postal_code.to_s,
|
||||
},
|
||||
POSTAL_ZIP: user.shipping_postal_code.to_s
|
||||
}
|
||||
},
|
||||
)
|
||||
success = true
|
||||
|
|
@ -67,8 +67,8 @@ class MailchimpBot
|
|||
TWITTER: user.twitter_username.to_s,
|
||||
GITHUB: user.github_username.to_s,
|
||||
IMAGE_URL: user.profile_image_url.to_s,
|
||||
MEMBERSHIP: membership.to_s,
|
||||
},
|
||||
MEMBERSHIP: membership.to_s
|
||||
}
|
||||
},
|
||||
)
|
||||
success = true
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class MarkdownParser
|
|||
renderer_options = {
|
||||
hard_wrap: true,
|
||||
filter_html: false,
|
||||
link_attributes: { rel: "noopener noreferrer", target: "_blank" },
|
||||
link_attributes: { rel: "noopener noreferrer", target: "_blank" }
|
||||
}
|
||||
renderer = Redcarpet::Render::HTMLRouge.new(renderer_options)
|
||||
markdown = Redcarpet::Markdown.new(renderer, REDCARPET_CONFIG)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ReactionImage
|
|||
"unicorn" => "emoji/emoji-one-unicorn.png",
|
||||
"hands" => "emoji/emoji-one-hands.png",
|
||||
"thinking" => "emoji/emoji-one-thinking.png",
|
||||
"readinglist" => "emoji/emoji-one-bookmark.png",
|
||||
"readinglist" => "emoji/emoji-one-bookmark.png"
|
||||
}.freeze
|
||||
images[category]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class RssReader
|
|||
published_from_feed: true,
|
||||
show_comments: true,
|
||||
body_markdown: assemble_body_markdown(item, user, feed, feed_source_url),
|
||||
organization_id: user.organization_id.present? ? user.organization_id : nil,
|
||||
organization_id: user.organization_id.present? ? user.organization_id : nil
|
||||
}
|
||||
article = Article.create!(article_params)
|
||||
SlackBot.delay.ping(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class UserStates
|
|||
fill_out_your_profile: fill_out_your_profile,
|
||||
leave_your_first_reaction: leave_reactions,
|
||||
follow_your_first_dev: follow_people,
|
||||
leave_your_first_comment: leave_comments,
|
||||
leave_your_first_comment: leave_comments
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class PodcastTag < LiquidTagBase
|
|||
itunes: "https://d.ibtimes.co.uk/en/full/1423047/itunes-12.png",
|
||||
overcast: "https://d2uzvmey2c90kn.cloudfront.net/img/logo.svg",
|
||||
android: "http://storage.googleapis.com/ix_choosemuse/uploads/2016/02/android-logo.png",
|
||||
rss: "https://temenos.com/globalassets/img/marketplace/temenos/rss/rss.png",
|
||||
rss: "https://temenos.com/globalassets/img/marketplace/temenos/rss/rss.png"
|
||||
}.freeze
|
||||
|
||||
def initialize(_tag_name, link, _tokens)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class BufferUpdate < ApplicationRecord
|
|||
text,
|
||||
profile_ids: [
|
||||
buffer_profile_id_code,
|
||||
],
|
||||
]
|
||||
},
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ class ChatChannel < ApplicationRecord
|
|||
name: membership.user.name,
|
||||
last_opened_at: membership.last_opened_at,
|
||||
username: membership.user.username,
|
||||
id: membership.user_id,
|
||||
id: membership.user_id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ class FeedbackMessage < ApplicationRecord
|
|||
validates_presence_of :reported_url, :category, if: :abuse_report?
|
||||
validates :category,
|
||||
inclusion: {
|
||||
in: ["spam", "other", "rude or vulgar", "harassment", "bug"],
|
||||
in: ["spam", "other", "rude or vulgar", "harassment", "bug"]
|
||||
}
|
||||
validates :status,
|
||||
inclusion: {
|
||||
in: ["Open", "Invalid", "Resolved"],
|
||||
in: ["Open", "Invalid", "Resolved"]
|
||||
}
|
||||
|
||||
def abuse_report?
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Follow < ApplicationRecord
|
|||
}, column_names: {
|
||||
["follows.followable_type = ?", "User"] => "following_users_count",
|
||||
["follows.followable_type = ?", "Organization"] => "following_orgs_count",
|
||||
["follows.followable_type = ?", "ActsAsTaggableOn::Tag"] => "following_tags_count",
|
||||
["follows.followable_type = ?", "ActsAsTaggableOn::Tag"] => "following_tags_count"
|
||||
}
|
||||
after_save :touch_user
|
||||
after_save :touch_user_followed_at
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class JobOpportunity < ApplicationRecord
|
|||
"on_premise" => "In Office",
|
||||
"fully_remote" => "Fully Remote",
|
||||
"remote_optional" => "Remote Optional",
|
||||
"on_premise_flexible" => "Mostly in Office but Flexible",
|
||||
"on_premise_flexible" => "Mostly in Office but Flexible"
|
||||
}
|
||||
phrases[remoteness]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Message < ApplicationRecord
|
|||
vapid: {
|
||||
subject: "https://dev.to",
|
||||
public_key: ApplicationConfig["VAPID_PUBLIC_KEY"],
|
||||
private_key: ApplicationConfig["VAPID_PRIVATE_KEY"],
|
||||
private_key: ApplicationConfig["VAPID_PRIVATE_KEY"]
|
||||
},
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class Role < ApplicationRecord
|
|||
chatroom_beta_tester
|
||||
banned_from_mentorship
|
||||
comment_banned
|
||||
),
|
||||
)
|
||||
}
|
||||
scopify
|
||||
end
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class Tweet < ApplicationRecord
|
|||
iden = Identity.where(provider: "twitter").last(250).sample
|
||||
{
|
||||
token: iden&.token || ApplicationConfig["TWITTER_KEY"],
|
||||
secret: iden&.secret || ApplicationConfig["TWITTER_SECRET"],
|
||||
secret: iden&.secret || ApplicationConfig["TWITTER_SECRET"]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class MembershipService
|
|||
def update_stripe_plan_for_subscription
|
||||
subscription.items = [{
|
||||
id: subscription.items.data[0].id,
|
||||
plan: plan.id,
|
||||
plan: plan.id
|
||||
}]
|
||||
subscription.save
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Rails.application.configure do
|
|||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=172800",
|
||||
"Cache-Control" => "public, max-age=172800"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
|
@ -75,7 +75,7 @@ Rails.application.configure do
|
|||
user_name: '<%= ENV["DEVELOPMENT_EMAIL_USERNAME"] %>',
|
||||
password: '<%= ENV["DEVELOPMENT_EMAIL_PASSWORD"] %>',
|
||||
authentication: :plain,
|
||||
domain: "localhost:3000",
|
||||
domain: "localhost:3000"
|
||||
}
|
||||
|
||||
config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Rails.application.configure do
|
|||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, s-maxage=2592000, max-age=86400",
|
||||
"Cache-Control" => "public, s-maxage=2592000, max-age=86400"
|
||||
}
|
||||
|
||||
# Compress JavaScripts and CSS.
|
||||
|
|
@ -120,7 +120,7 @@ Rails.application.configure do
|
|||
user_name: ENV["SENDGRID_USERNAME_ACCEL"],
|
||||
password: ENV["SENDGRID_PASSWORD_ACCEL"],
|
||||
domain: "dev.to",
|
||||
enable_starttls_auto: true,
|
||||
enable_starttls_auto: true
|
||||
}
|
||||
|
||||
config.middleware.use Rack::HostRedirect,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Rails.application.configure do
|
|||
# Configure static file server for tests with Cache-Control for performance.
|
||||
config.public_file_server.enabled = true
|
||||
config.public_file_server.headers = {
|
||||
"Cache-Control" => "public, max-age=3600",
|
||||
"Cache-Control" => "public, max-age=3600"
|
||||
}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
AlgoliaSearch.configuration = {
|
||||
application_id: ApplicationConfig["ALGOLIASEARCH_APPLICATION_ID"],
|
||||
api_key: ApplicationConfig["ALGOLIASEARCH_API_KEY"],
|
||||
api_key: ApplicationConfig["ALGOLIASEARCH_API_KEY"]
|
||||
}
|
||||
|
||||
if Rails.env.test?
|
||||
|
|
@ -15,7 +15,7 @@ else
|
|||
"ordered_articles_by_published_at_#{Rails.env}",
|
||||
"ordered_articles_by_positive_reactions_count_#{Rails.env}",
|
||||
"ordered_comments_#{Rails.env}",
|
||||
].join(","),
|
||||
].join(",")
|
||||
}
|
||||
secured_algolia_key = Algolia.generate_secured_api_key(
|
||||
ApplicationConfig["ALGOLIASEARCH_SEARCH_ONLY_KEY"], params
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ CarrierWave.configure do |config|
|
|||
provider: "AWS",
|
||||
aws_access_key_id: ApplicationConfig["AWS_ID"],
|
||||
aws_secret_access_key: ApplicationConfig["AWS_SECRET"],
|
||||
region: "us-east-1",
|
||||
region: "us-east-1"
|
||||
}
|
||||
config.fog_directory = ApplicationConfig["AWS_BUCKET_NAME"]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ module ActionController
|
|||
cookies.encrypted[COOKIE_NAME] ||= {
|
||||
value: csrf_token,
|
||||
expires: 1.year.from_now,
|
||||
httponly: true,
|
||||
httponly: true
|
||||
}
|
||||
session[:_csrf_token] = csrf_token
|
||||
Base64.strict_decode64(csrf_token)
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@
|
|||
strikethrough: true,
|
||||
superscript: true,
|
||||
tables: true,
|
||||
footnotes: true,
|
||||
footnotes: true
|
||||
}.freeze
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Rails.configuration.stripe = {
|
||||
publishable_key: ApplicationConfig["STRIPE_PUBLISHABLE_KEY"],
|
||||
secret_key: ApplicationConfig["STRIPE_SECRET_KEY"],
|
||||
secret_key: ApplicationConfig["STRIPE_SECRET_KEY"]
|
||||
}
|
||||
|
||||
Stripe.api_key = Rails.configuration.stripe[:secret_key]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Rails.application.routes.draw do
|
|||
devise_for :users, controllers: {
|
||||
omniauth_callbacks: "omniauth_callbacks",
|
||||
session: "sessions",
|
||||
registrations: "registrations",
|
||||
registrations: "registrations"
|
||||
}
|
||||
|
||||
devise_scope :user do
|
||||
|
|
@ -226,7 +226,7 @@ Rails.application.routes.draw do
|
|||
get "/dashboard" => "dashboards#show"
|
||||
get "/dashboard/:which" => "dashboards#show",
|
||||
constraints: {
|
||||
which: /organization|user_followers|following_users|reading/,
|
||||
which: /organization|user_followers|following_users|reading/
|
||||
}
|
||||
get "/dashboard/:username" => "dashboards#show"
|
||||
|
||||
|
|
|
|||
10
db/seeds.rb
10
db/seeds.rb
|
|
@ -107,7 +107,7 @@ Comment.clear_index!
|
|||
body_markdown: Faker::Hipster.paragraph(1),
|
||||
user_id: User.order("RANDOM()").first.id,
|
||||
commentable_id: Article.order("RANDOM()").first.id,
|
||||
commentable_type: "Article",
|
||||
commentable_type: "Article"
|
||||
}
|
||||
Comment.create!(attributes)
|
||||
end
|
||||
|
|
@ -131,7 +131,7 @@ podcast_objects = [
|
|||
main_color_hex: "111111",
|
||||
overcast_url: "https://overcast.fm/itunes769189585/coding-blocks-software-and-web-programming-security-best-practices-microsoft-net", # rubocop:disable Metrics/LineLength
|
||||
android_url: "http://subscribeonandroid.com/feeds.podtrac.com/c8yBGHRafqhz",
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"),
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg")
|
||||
},
|
||||
{
|
||||
title: "Talk Python",
|
||||
|
|
@ -143,7 +143,7 @@ podcast_objects = [
|
|||
main_color_hex: "181a1c",
|
||||
overcast_url: "https://overcast.fm/itunes979020229/talk-python-to-me-python-conversations-for-passionate-developers", # rubocop:disable Metrics/LineLength
|
||||
android_url: "https://subscribeonandroid.com/talkpython.fm/episodes/rss",
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"),
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg")
|
||||
},
|
||||
{
|
||||
title: "Developer on Fire",
|
||||
|
|
@ -156,7 +156,7 @@ podcast_objects = [
|
|||
main_color_hex: "",
|
||||
overcast_url: "https://overcast.fm/itunes1006105326/developer-on-fire",
|
||||
android_url: "http://subscribeonandroid.com/developeronfire.com/rss.xml",
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"),
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg")
|
||||
},
|
||||
{
|
||||
title: "Building Programmers",
|
||||
|
|
@ -169,7 +169,7 @@ podcast_objects = [
|
|||
main_color_hex: "140837",
|
||||
overcast_url: "https://overcast.fm/itunes1149043456/building-programmers",
|
||||
android_url: "https://subscribeonandroid.com/building.fireside.fm/rss",
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg"),
|
||||
image: Rack::Test::UploadedFile.new(image_file, "image/jpeg")
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ RSpec.describe MailchimpBot do
|
|||
EXPERIENCE: user.experience_level || 666,
|
||||
COUNTRY: user.shipping_country.to_s,
|
||||
STATE: user.shipping_state.to_s,
|
||||
POSTAL_ZIP: user.shipping_postal_code.to_s,
|
||||
},
|
||||
},
|
||||
POSTAL_ZIP: user.shipping_postal_code.to_s
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
vcr_option = {
|
||||
cassette_name: "se_daily_rss_feed",
|
||||
allow_playback_repeats: "true",
|
||||
allow_playback_repeats: "true"
|
||||
}
|
||||
|
||||
RSpec.describe PodcastFeed, vcr: vcr_option do
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require "rss"
|
|||
|
||||
vcr_option = {
|
||||
cassette_name: "rss_feeds",
|
||||
allow_playback_repeats: "true",
|
||||
allow_playback_repeats: "true"
|
||||
}
|
||||
|
||||
RSpec.describe RssReader, vcr: vcr_option do
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
vcr_option = {
|
||||
cassette_name: "github_api",
|
||||
allow_playback_repeats: "true",
|
||||
allow_playback_repeats: "true"
|
||||
}
|
||||
|
||||
RSpec.describe GithubTag::GithubIssueTag, vcr: vcr_option do
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ require "rails_helper"
|
|||
|
||||
vcr_option = {
|
||||
cassette_name: "github_api_readme",
|
||||
allow_playback_repeats: "true",
|
||||
allow_playback_repeats: "true"
|
||||
}
|
||||
|
||||
RSpec.describe GithubTag::GithubReadmeTag, vcr: vcr_option do
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
email_subject: "dev.to Status Update",
|
||||
email_body: "You've violated our code of conduct",
|
||||
email_type: "Reporter",
|
||||
feedback_message_id: feedback_message_id,
|
||||
feedback_message_id: feedback_message_id
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
vcr_option = {
|
||||
cassette_name: "twitter_gem",
|
||||
allow_playback_repeats: "true",
|
||||
allow_playback_repeats: "true"
|
||||
}
|
||||
|
||||
RSpec.describe Tweet, type: :model, vcr: vcr_option do
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ RSpec.describe "ArticlesCreate", type: :request do
|
|||
it "creates ordinary article with proper params" do
|
||||
new_title = "NEW TITLE #{rand(100)}"
|
||||
post "/articles", params: {
|
||||
article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" },
|
||||
article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" }
|
||||
}
|
||||
expect(Article.last.user_id).to eq(user.id)
|
||||
end
|
||||
|
|
@ -20,8 +20,8 @@ RSpec.describe "ArticlesCreate", type: :request do
|
|||
post "/articles", params: {
|
||||
article: {
|
||||
body_markdown: "---\ntitle: hey hey hahuu\npublished: false\n---\nYo ho ho#{rand(100)}",
|
||||
tag_list: "yo",
|
||||
},
|
||||
tag_list: "yo"
|
||||
}
|
||||
}
|
||||
expect(Article.last.title).to eq("hey hey hahuu")
|
||||
end
|
||||
|
|
@ -34,7 +34,7 @@ RSpec.describe "ArticlesCreate", type: :request do
|
|||
title: new_title,
|
||||
body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yoyo",
|
||||
job_opportunity: { remoteness: "on_premise" }
|
||||
},
|
||||
}
|
||||
}
|
||||
end .to raise_error(RuntimeError)
|
||||
end
|
||||
|
|
@ -46,7 +46,7 @@ RSpec.describe "ArticlesCreate", type: :request do
|
|||
title: new_title,
|
||||
body_markdown: "Yo ho ho#{rand(100)}", tag_list: "hiring",
|
||||
job_opportunity: { remoteness: "on_premise" }
|
||||
},
|
||||
}
|
||||
}
|
||||
expect(Article.last.job_opportunity.remoteness).to eq("on_premise")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ RSpec.describe "ArticlesUpdate", type: :request do
|
|||
it "updates ordinary article with proper params" do
|
||||
new_title = "NEW TITLE #{rand(100)}"
|
||||
put "/articles/#{article.id}", params: {
|
||||
article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" },
|
||||
article: { title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo" }
|
||||
}
|
||||
expect(Article.last.title).to eq(new_title)
|
||||
end
|
||||
|
|
@ -23,7 +23,7 @@ RSpec.describe "ArticlesUpdate", type: :request do
|
|||
article: {
|
||||
title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "yo",
|
||||
job_opportunity: { remoteness: "on_premise" }
|
||||
},
|
||||
}
|
||||
}
|
||||
expect(JobOpportunity.count).to eq(0)
|
||||
end
|
||||
|
|
@ -34,7 +34,7 @@ RSpec.describe "ArticlesUpdate", type: :request do
|
|||
article: {
|
||||
title: new_title, body_markdown: "Yo ho ho#{rand(100)}", tag_list: "hiring",
|
||||
job_opportunity: { remoteness: "on_premise" }
|
||||
},
|
||||
}
|
||||
}
|
||||
expect(Article.last.job_opportunity.remoteness).to eq("on_premise")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ RSpec.describe "Blocks", type: :request do
|
|||
block: {
|
||||
input_css: ".blue { color: blue;}",
|
||||
input_html: "yo",
|
||||
input_javascript: "alert('hey')",
|
||||
},
|
||||
input_javascript: "alert('hey')"
|
||||
}
|
||||
}
|
||||
expect(Block.all.size).to eq(1)
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ RSpec.describe "Blocks", type: :request do
|
|||
put "/blocks/#{block.id}", params: {
|
||||
block: { input_css: ".blue { color: red;}",
|
||||
input_html: "yo",
|
||||
input_javascript: "alert('hey')" },
|
||||
input_javascript: "alert('hey')" }
|
||||
}
|
||||
expect(Block.last.processed_css).to include("color: red")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do
|
|||
post "/chat_channel_memberships", params: {
|
||||
chat_channel_membership: {
|
||||
user_id: second_user.id, chat_channel_id: chat_channel.id
|
||||
},
|
||||
}
|
||||
}
|
||||
expect(ChatChannelMembership.all.size).to eq(mems_num + 1)
|
||||
expect(ChatChannelMembership.last.status).to eq("pending")
|
||||
|
|
@ -29,7 +29,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do
|
|||
post "/chat_channel_memberships", params: {
|
||||
chat_channel_membership: {
|
||||
user_id: second_user.id, chat_channel_id: chat_channel.id
|
||||
},
|
||||
}
|
||||
}
|
||||
end.to raise_error(Pundit::NotAuthorizedError)
|
||||
end
|
||||
|
|
@ -39,7 +39,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do
|
|||
before do
|
||||
user.add_role(:super_admin)
|
||||
post "/chat_channel_memberships", params: {
|
||||
chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id },
|
||||
chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id }
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -48,8 +48,8 @@ RSpec.describe "ChatChannelMemberships", type: :request do
|
|||
sign_in second_user
|
||||
put "/chat_channel_memberships/#{membership.id}", params: {
|
||||
chat_channel_membership: {
|
||||
user_action: "accept",
|
||||
},
|
||||
user_action: "accept"
|
||||
}
|
||||
}
|
||||
expect(ChatChannelMembership.find(membership.id).status).to eq("active")
|
||||
end
|
||||
|
|
@ -58,7 +58,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do
|
|||
membership = ChatChannelMembership.last
|
||||
sign_in second_user
|
||||
put "/chat_channel_memberships/#{membership.id}", params: {
|
||||
chat_channel_membership: { user_action: "reject" },
|
||||
chat_channel_membership: { user_action: "reject" }
|
||||
}
|
||||
expect(ChatChannelMembership.find(membership.id).status).to eq("rejected")
|
||||
end
|
||||
|
|
@ -67,7 +67,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do
|
|||
membership = ChatChannelMembership.last
|
||||
expect do
|
||||
put "/chat_channel_memberships/#{membership.id}", params: {
|
||||
chat_channel_membership: { user_action: "accept" },
|
||||
chat_channel_membership: { user_action: "accept" }
|
||||
}
|
||||
expect(ChatChannelMembership.find(membership.id).status).to eq("active")
|
||||
end.to raise_error(Pundit::NotAuthorizedError)
|
||||
|
|
@ -78,7 +78,7 @@ RSpec.describe "ChatChannelMemberships", type: :request do
|
|||
before do
|
||||
user.add_role(:super_admin)
|
||||
post "/chat_channel_memberships", params: {
|
||||
chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id },
|
||||
chat_channel_membership: { user_id: second_user.id, chat_channel_id: chat_channel.id }
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ RSpec.describe "CommentsCreate", type: :request do
|
|||
it "creates ordinary article with proper params" do
|
||||
new_body = "NEW BODY #{rand(100)}"
|
||||
post "/comments", params: {
|
||||
comment: { body_markdown: new_body, commentable_id: article.id, commentable_type: "Article" },
|
||||
comment: { body_markdown: new_body, commentable_id: article.id, commentable_type: "Article" }
|
||||
}
|
||||
expect(Comment.last.user_id).to eq(user.id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ RSpec.describe "CommentsUpdate", type: :request do
|
|||
it "updates ordinary article with proper params" do
|
||||
new_body = "NEW TITLE #{rand(100)}"
|
||||
put "/comments/#{comment.id}", params: {
|
||||
comment: { body_markdown: new_body },
|
||||
comment: { body_markdown: new_body }
|
||||
}
|
||||
expect(Comment.last.processed_html).to include(new_body)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
vcr_option = {
|
||||
cassette_name: "ga_event",
|
||||
allow_playback_repeats: "true",
|
||||
allow_playback_repeats: "true"
|
||||
}
|
||||
|
||||
RSpec.describe "GaEvents", type: :request, vcr: vcr_option do
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ RSpec.describe "Messages", type: :request do
|
|||
{
|
||||
message_markdown: "hi",
|
||||
user_id: user.id,
|
||||
chat_channel_id: chat_channel.id,
|
||||
chat_channel_id: chat_channel.id
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ RSpec.describe "OrganizationsUpdate", type: :request do
|
|||
|
||||
it "updates ordinary article with proper params" do
|
||||
put "/organizations/#{organization.id}", params: {
|
||||
organization: { text_color_hex: "#111111" },
|
||||
organization: { text_color_hex: "#111111" }
|
||||
}
|
||||
expect(Organization.last.text_color_hex).to eq("#111111")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
vcr_option = {
|
||||
cassette_name: "se_daily_rss_feed",
|
||||
allow_playback_repeats: "true",
|
||||
allow_playback_repeats: "true"
|
||||
}
|
||||
|
||||
RSpec.describe "ArticlesApi", type: :request, vcr: vcr_option do
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ RSpec.describe "PusherAuth", type: :request do
|
|||
describe "POST /pusher/auth" do
|
||||
it "returns forbidden with invalid channel" do
|
||||
post "/pusher/auth", params: {
|
||||
channel_name: "hey hey hey hey",
|
||||
channel_name: "hey hey hey hey"
|
||||
}
|
||||
expect(response.body).to include("Forbidden")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ RSpec.describe "Reactions", type: :request do
|
|||
{
|
||||
reactable_id: article.id,
|
||||
reactable_type: "Article",
|
||||
category: "like",
|
||||
category: "like"
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ RSpec.describe "StripeSubscriptions", type: :request do
|
|||
before do
|
||||
post "/stripe_subscriptions", params: {
|
||||
amount: "12",
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ RSpec.describe "StripeSubscriptions", type: :request do
|
|||
it "can't accept anything less than $1" do
|
||||
post "/stripe_subscriptions", params: {
|
||||
amount: rand(100) / 100,
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
expect(response).to redirect_to("/membership")
|
||||
user.reload
|
||||
|
|
@ -95,14 +95,14 @@ RSpec.describe "StripeSubscriptions", type: :request do
|
|||
before do
|
||||
post "/stripe_subscriptions", params: {
|
||||
amount: "12",
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
end
|
||||
|
||||
it "assigns the proper role with a new subscription" do
|
||||
put "/stripe_subscriptions/current_user", params: {
|
||||
amount: "30",
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
expect(user.has_role?("level_4_member")).to eq(true)
|
||||
end
|
||||
|
|
@ -110,7 +110,7 @@ RSpec.describe "StripeSubscriptions", type: :request do
|
|||
it "updates the user's monthly_dues with the proper amount" do
|
||||
put "/stripe_subscriptions/current_user", params: {
|
||||
amount: "30",
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
user.reload
|
||||
expect(user.monthly_dues).to eq(3000)
|
||||
|
|
@ -121,7 +121,7 @@ RSpec.describe "StripeSubscriptions", type: :request do
|
|||
allow(mock_instance).to receive(:update_subscription).and_return(nil)
|
||||
put "/stripe_subscriptions/current_user", params: {
|
||||
amount: "30",
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
expect(response).to redirect_to("/settings/membership")
|
||||
end
|
||||
|
|
@ -141,21 +141,21 @@ RSpec.describe "StripeSubscriptions", type: :request do
|
|||
user.add_role(:level_2_member)
|
||||
post "/stripe_subscriptions", params: {
|
||||
amount: "12",
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
end
|
||||
|
||||
context "when a valid request is made" do
|
||||
it "deletes membership" do
|
||||
delete "/stripe_subscriptions/current_user", params: {
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
expect(user.has_role?("level_2_member")).to eq(false)
|
||||
end
|
||||
|
||||
it "returns user monthly dues to zero" do
|
||||
delete "/stripe_subscriptions/current_user", params: {
|
||||
stripe_token: stripe_helper.generate_card_token,
|
||||
stripe_token: stripe_helper.generate_card_token
|
||||
}
|
||||
user.reload
|
||||
expect(user.monthly_dues).to eq(0)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ RSpec.describe "Tags", type: :request, proper_status: true do
|
|||
it "displays proper error messages" do
|
||||
invalid_text_color_hex = "udjsadasfkdjsa"
|
||||
patch "/tag/#{tag.id}", params: {
|
||||
tag: { text_color_hex: invalid_text_color_hex, bg_color_hex: "" },
|
||||
tag: { text_color_hex: invalid_text_color_hex, bg_color_hex: "" }
|
||||
}
|
||||
expect(response.body).to include("Text color hex is invalid")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ RSpec.describe "Videos", type: :request do
|
|||
|
||||
valid_params = {
|
||||
article: {
|
||||
video: "something.mp4",
|
||||
},
|
||||
video: "something.mp4"
|
||||
}
|
||||
}
|
||||
|
||||
xit "creates an article for the logged in user" do
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ RSpec.describe UserRoleService do
|
|||
note_params = {
|
||||
reason: "banned",
|
||||
content: "some reason",
|
||||
noteable_type: "User",
|
||||
noteable_type: "User"
|
||||
}
|
||||
|
||||
it "updates a user's previous note" do
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module OmniauthMacros
|
|||
uid: "1234567",
|
||||
info: INFO,
|
||||
extra: EXTRA_INFO,
|
||||
credentials: CREDENTIAL,
|
||||
credentials: CREDENTIAL
|
||||
}
|
||||
|
||||
def mock_auth_hash
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue