Skip to content

Commit

Permalink
Show a warning when trying to set Makara::Cache.store
Browse files Browse the repository at this point in the history
  • Loading branch information
rosa committed Feb 22, 2018
1 parent 0d81dbf commit 5ef0bb8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/makara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'makara/railtie' if defined?(Rails)
module Makara

autoload :Cache, 'makara/cache'
autoload :ConfigParser, 'makara/config_parser'
autoload :ConnectionWrapper, 'makara/connection_wrapper'
autoload :Context, 'makara/context'
Expand Down
20 changes: 20 additions & 0 deletions lib/makara/cache.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module Makara
module Cache

class << self

def store=(store)
Logging::Logger.log deprecation_warning, :warn
end

private

def deprecation_warning
<<~WARN
Makara's context is no longer persisted in a backend cache, a cookie store is used by default.
Setting the Makara::Cache.store won't have any effects.
WARN
end
end
end
end
9 changes: 9 additions & 0 deletions spec/cache_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'spec_helper'

describe Makara::Cache do

it 'shows a warning' do
expect(Makara::Logging::Logger).to receive(:log).with(/Setting the Makara::Cache\.store won't have any effects/, :warn)
described_class.store = :noop
end
end

0 comments on commit 5ef0bb8

Please sign in to comment.