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