diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f1dee2789..f13b05e88 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,12 +1,12 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2019-10-28 15:15:12 +0100 using RuboCop version 0.75.1. +# on 2019-11-19 11:07:38 +0100 using RuboCop version 0.76.0. # 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: 235 +# Offense count: 232 Metrics/AbcSize: Max: 75 @@ -16,6 +16,11 @@ Metrics/AbcSize: Metrics/BlockLength: Max: 62 +# Offense count: 1 +Naming/ConstantName: + Exclude: + - 'config/initializers/redis_rails.rb' + # Offense count: 6 # Configuration parameters: Max. RSpec/ExampleLength: @@ -26,16 +31,11 @@ RSpec/ExampleLength: - 'spec/requests/api/v0/articles_spec.rb' - 'spec/requests/display_ad_events_spec.rb' -# Offense count: 444 +# Offense count: 452 # Configuration parameters: AggregateFailuresByDefault. RSpec/MultipleExpectations: Max: 8 -# Offense count: 1 -RSpec/UnspecifiedException: - Exclude: - - 'spec/requests/messages_spec.rb' - # Offense count: 1 # Configuration parameters: Include. # Include: app/helpers/**/*.rb @@ -56,7 +56,7 @@ Rails/OutputSafety: - 'app/models/message.rb' - 'app/views/articles/feed.rss.builder' -# Offense count: 23 +# Offense count: 24 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, EnforcedStyle. # SupportedStyles: nested, compact @@ -69,7 +69,7 @@ Style/GuardClause: Exclude: - 'app/models/article.rb' -# Offense count: 3143 +# Offense count: 3185 # Cop supports --auto-correct. # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # URISchemes: http, https diff --git a/config/environments/production.rb b/config/environments/production.rb index 2d362c223..1b5e9fcf5 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -126,7 +126,7 @@ Rails.application.configure do ENV["HEROKU_APP_URL"] => ENV["APP_DOMAIN"] end -Rails.application.routes.default_url_options = { +Rails.application.routes.default_url_options = { host: Rails.application.config.app_domain, protocol: ENV["APP_PROTOCOL"].delete_suffix("://") } diff --git a/config/initializers/redis_rails.rb b/config/initializers/redis_rails.rb index b42e47c93..1e9679e66 100644 --- a/config/initializers/redis_rails.rb +++ b/config/initializers/redis_rails.rb @@ -3,11 +3,11 @@ redis_url = ENV["REDISCLOUD_URL"] redis_url ||= ApplicationConfig["REDIS_URL"] DEFAULT_EXPIRATION = 24.hours.to_i.freeze -if Rails.env.test? - RedisRailsCache = ActiveSupport::Cache::NullStore.new -# Uncomment these lines to use MemoryStory in development -# elsif Rails.env.development? -# RedisRailsCache = ActiveSupport::Cache::MemoryStore.new -else - RedisRailsCache = ActiveSupport::Cache::RedisCacheStore.new(url: redis_url, expires_in: DEFAULT_EXPIRATION) -end +RedisRailsCache = if Rails.env.test? + ActiveSupport::Cache::NullStore.new + # Uncomment these lines to use MemoryStory in development + # elsif Rails.env.development? + # RedisRailsCache = ActiveSupport::Cache::MemoryStore.new + else + ActiveSupport::Cache::RedisCacheStore.new(url: redis_url, expires_in: DEFAULT_EXPIRATION) + end diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index c4ac6b303..d453edaf1 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -4,13 +4,12 @@ RSpec.describe Tag, type: :model do let(:tag) { build(:tag) } describe "validations" do - describe "bg_color_hex" do it "passes validations if bg_color_hex is valid" do tag.bg_color_hex = "#000000" expect(tag).to be_valid end - + it "fails validation if bg_color_hex is invalid" do tag.bg_color_hex = "0000000" expect(tag).not_to be_valid @@ -22,7 +21,7 @@ RSpec.describe Tag, type: :model do tag.text_color_hex = "#000000" expect(tag).to be_valid end - + it "fails validation if text_color_hex is invalid" do tag.text_color_hex = "0000000" expect(tag).not_to be_valid @@ -45,7 +44,6 @@ RSpec.describe Tag, type: :model do tag.alias_for = "hello" expect(tag).not_to be_valid end - end it "turns markdown into HTML before saving" do