Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Update to around_action instead of now deprecated around_filter #44

Merged
merged 1 commit into from
Aug 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
66 changes: 45 additions & 21 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
0.3.4 - SEP.28.2015
### 0.3.5 - AUG.18.2016
* `around_filter` is deprecated in Rails 5 and will be removed in Rails 5.1. Uses `around_action` if available and falls back to `around_filter` otherwise.


### 0.3.4 - SEP.28.2015
* Maintenance release with minor changes and a security fix
* fix JS error when flash cookie is not set (new version of jquery.cookie returns undefined when a cookie does not exist) [nickurban]
* Reflected XSS vulnerability fix [rubyconvict]
* If domain is not set, do not force as empty string. Breaks IE. [ndreckshage]
* Update CacheableFlash::RspecMatchers and rspec test suite for latest Rspec v3.3 [Peter Boling]

0.3.3 - SEP.13.2013

### 0.3.3 - SEP.13.2013
* Maintenance release with lots of minor changes and fixes.
* Main gem should be API compatible.
* Small changes to test helpers which will require updating tests using them.

0.3.2 - AUG.23.2012

### 0.3.2 - AUG.23.2012
* Properly handles stacked flash in cookie flash according to config :append_as option [Peter Boling]

0.3.1 - AUG.22.2012

### 0.3.1 - AUG.22.2012
* Add specs for non stacking use [Peter Boling]
* Use stackable_flash/test_helpers instead of reinventing the wheel [Peter Boling]
* Config now works! [Peter Boling]
* Update to stackable_flash 0.0.7 (working config) [Peter Boling]
* default to non stacking [Peter Boling]

0.3.0 - AUG.21.2012

### 0.3.0 - AUG.21.2012
- Completed integration with stackable_flash (http://github.com/pboling/stackable_flash)
- Test::Unit helpers and Rspec Matchers updated to be stackable
- Expanded test suite
Expand All @@ -32,7 +40,8 @@
- (v0.2.X converted everything to string)
- the CacheableFlash::Config class is experimental, and no code uses the config settings yet.

0.2.10 - AUG.13.2012

### 0.2.10 - AUG.13.2012
- Split test_helpers from rspec_matchers (test_helpers may be useful in TestUnit
- When using Middleware: Flash Cookies now stay in the cookie until cleared out by the javascript: closer to guaranteed delivery.
- Improved spec suite
Expand All @@ -41,44 +50,54 @@
- Added facets runtime dependency
- corrected namespace of CacheableFlash::CookieFlash

0.2.9 - AUG.08.2012

### 0.2.9 - AUG.08.2012
- More rearranging
- Improved integration test of CacheableFlash & CacheableFlash::TestHelpers
- Updated to latest jquery.cookie

0.2.8 - AUG.07.2012

### 0.2.8 - AUG.07.2012
- switch from jeweler to gem-release for bumping and tagging
- bundler update (1.0.24)
- Escape HTML in flash values unless they're html_safe
- Add CacheableFlash rack middleware

0.2.7 - JUN.21.2012

### 0.2.7 - JUN.21.2012
- Note: Does not support flash.now feature of the FlashHash in Rails
- Corrected directory names for controllers/layouts

0.2.6 - unreleased

### 0.2.6 - unreleased
- all specs pass with rspec 2.10

0.2.5 - MAR.01.2012

### 0.2.5 - MAR.01.2012
- Real integration test!

0.2.4 - FEB.27.2012

### 0.2.4 - FEB.27.2012
- Dependency diet! No longer requires all of rails - only railties.

0.2.3 - JAN.13.2012

### 0.2.3 - JAN.13.2012
- Fixed problems loading assets: Sprockets::FileNotFound - thanks jlxw
- reflect move back to pivotal's repo in README.
- Updated specs, to running and passing condition!
- Made rails > 3.0 a dependency, since it is (uses ::Rails::Engine and :Rails::Railtie)

0.2.2 - SEP.10.2011

### 0.2.2 - SEP.10.2011
- Improved deprecation warnings about using the generator (not needed with asset pipeline)
- Improved README setup instructions

0.2.1 - SEP.10.2011

### 0.2.1 - SEP.10.2011
- Fixed bug in generator for those not using asset pipeline, or pre Rails 3.1

0.2.0 - SEP.10.2011 [Peter Boling begins gemification process]

### 0.2.0 - SEP.10.2011 [Peter Boling begins gemification process]
- Converted to a gem
- Updated to improved, patched jquery.cookie from https://github.com/pboling/jquery-cookie
- Merged a few other forks of cacheable-flash
Expand All @@ -89,21 +108,26 @@
Unreleased
- Implicitly adding js files to Rails include defaults (Patch from Michael Erb)

0.1.5

### 0.1.5
- Requiring version >= 1.1.2 of the json gem
- Converted tests into specs

0.1.4

### 0.1.4
- Added TestHelpers
- Added flash_cookie method for tests

0.1.3

### 0.1.3
- Require json in init.rb

0.1.2

### 0.1.2
- Flash on the Rails side is cleared when written to the cookie
- Uses existing cookie flash value
- Using Scriptaculous cookie.js library

0.1.1

### 0.1.1
- Added cookies.js
11 changes: 9 additions & 2 deletions lib/cacheable_flash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ module CacheableFlash
include CacheableFlash::CookieFlash

def self.included(base)
#base must define around_filter, as in Rails
base.around_filter :write_flash_to_cookie
#base must define around_action or around_filter, as in Rails

around_method = if base.respond_to?(:around_action)
:around_action
else
:around_filter
end

base.send around_method, :write_flash_to_cookie
end

def write_flash_to_cookie
Expand Down
2 changes: 1 addition & 1 deletion lib/cacheable_flash/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CacheableFlash
VERSION = "0.3.4"
VERSION = "0.3.5"
end
6 changes: 3 additions & 3 deletions spec/cacheable_flash/cacheable_flash_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
attr_reader :controller_class, :controller, :cookies
before do
@controller_class = Struct.new(:cookies, :flash)
allow(@controller_class).to receive(:around_filter)
allow(@controller_class).to receive(:around_action)
@controller_class.send(:include, CacheableFlash)
@controller = @controller_class.new({}, {})
@cookies = {}
Expand Down Expand Up @@ -120,8 +120,8 @@ def controller_cookie_flash
end

describe ".included" do
it "sets the around_filter on the controller to call #write_flash_to_cookie" do
expect(@controller_class).to receive(:around_filter).with(:write_flash_to_cookie)
it "sets the around_action on the controller to call #write_flash_to_cookie" do
expect(@controller_class).to receive(:around_action).with(:write_flash_to_cookie)
@controller_class.send(:include, CacheableFlash)
end
end
Expand Down