cacheable_flash 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -1,5 +1,5 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/CHANGES CHANGED
@@ -1,36 +1,42 @@
1
- 0.2.2
2
- - Improved deprecation warnings about using the generator (not needed with asset pipeline)
3
- - Improved README setup instructions
4
-
5
- 0.2.1
6
- - Fixed bug in generator for those not using asset pipeline, or pre Rails 3.1
7
-
8
- 0.2.0 [Peter Boling begins gemification process]
9
- - Converted to a gem
10
- - Updated to improved, patched jquery.cookie from https://github.com/pboling/jquery-cookie
11
- - Merged a few other forks of cacheable-flash
12
- - Added Engine to hook into Rails 3.1 asset pipeline
13
- - Added Railtie to improve usability with Rails 3.0
14
- - Added Generator to improve usability with Rails < 3
15
-
16
- Unreleased
17
- - Implicitly adding js files to Rails include defaults (Patch from Michael Erb)
18
-
19
- 0.1.5
20
- - Requiring version >= 1.1.2 of the json gem
21
- - Converted tests into specs
22
-
23
- 0.1.4
24
- - Added TestHelpers
25
- - Added flash_cookie method for tests
26
-
27
- 0.1.3
28
- - Require json in init.rb
29
-
30
- 0.1.2
31
- - Flash on the Rails side is cleared when written to the cookie
32
- - Uses existing cookie flash value
33
- - Using Scriptaculous cookie.js library
34
-
35
- 0.1.1
36
- - Added cookies.js
1
+ 0.2.3 - JAN.13.2012
2
+ - Fixed problems loading assets: Sprockets::FileNotFound - thanks jlxw
3
+ - reflect move back to pivotal's repo in README.
4
+ - Updated specs, to running and passing condition!
5
+ - Made rails > 3.0 a dependency, since it is (uses ::Rails::Engine and :Rails::Railtie)
6
+
7
+ 0.2.2
8
+ - Improved deprecation warnings about using the generator (not needed with asset pipeline)
9
+ - Improved README setup instructions
10
+
11
+ 0.2.1
12
+ - Fixed bug in generator for those not using asset pipeline, or pre Rails 3.1
13
+
14
+ 0.2.0 [Peter Boling begins gemification process]
15
+ - Converted to a gem
16
+ - Updated to improved, patched jquery.cookie from https://github.com/pboling/jquery-cookie
17
+ - Merged a few other forks of cacheable-flash
18
+ - Added Engine to hook into Rails 3.1 asset pipeline
19
+ - Added Railtie to improve usability with Rails 3.0
20
+ - Added Generator to improve usability with Rails < 3
21
+
22
+ Unreleased
23
+ - Implicitly adding js files to Rails include defaults (Patch from Michael Erb)
24
+
25
+ 0.1.5
26
+ - Requiring version >= 1.1.2 of the json gem
27
+ - Converted tests into specs
28
+
29
+ 0.1.4
30
+ - Added TestHelpers
31
+ - Added flash_cookie method for tests
32
+
33
+ 0.1.3
34
+ - Require json in init.rb
35
+
36
+ 0.1.2
37
+ - Flash on the Rails side is cleared when written to the cookie
38
+ - Uses existing cookie flash value
39
+ - Using Scriptaculous cookie.js library
40
+
41
+ 0.1.1
42
+ - Added cookies.js
data/Gemfile CHANGED
@@ -1,17 +1,20 @@
1
- source "http://rubygems.org"
2
-
3
- #gem "rails"
4
- #We don't really need all of rails... so:
5
- gem "activesupport"
6
- gem "actionpack"
7
- gem "json"
8
-
9
- # Develop dependencies (everything needed to run rake, tests, features, etc.)
10
- group :development do
11
- gem "rspec", "~> 2.3.0"
12
- gem "yard", "~> 0.6.0"
13
- gem "bundler", "~> 1.0.0"
14
- gem "jeweler", "~> 1.6.4"
15
- gem "reek", "~> 1.2.8"
16
- gem "roodi", "~> 2.1.0"
17
- end
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "> 3.0"
4
+ #We don't really need all of rails... so:
5
+ # Actually we do now that we have rails engine and rails railtie
6
+ # TODO: Investigate making a rails free version
7
+ #gem "activesupport"
8
+ #gem "activemodel"
9
+ #gem "actionpack"
10
+ gem "json"
11
+
12
+ # Develop dependencies (everything needed to run rake, tests, features, etc.)
13
+ group :development do
14
+ gem "rspec", "~> 2.8.0"
15
+ gem "yard", "~> 0.7.4"
16
+ gem "bundler", "~> 1.0.21"
17
+ gem "jeweler", "~> 1.6.4"
18
+ gem "reek", "~> 1.2.8"
19
+ gem "roodi", "~> 2.1.0"
20
+ end
data/Gemfile.lock CHANGED
@@ -1,82 +1,121 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- actionpack (3.1.0)
5
- activemodel (= 3.1.0)
6
- activesupport (= 3.1.0)
7
- builder (~> 3.0.0)
8
- erubis (~> 2.7.0)
9
- i18n (~> 0.6)
10
- rack (~> 1.3.2)
11
- rack-cache (~> 1.0.3)
12
- rack-mount (~> 0.8.2)
13
- rack-test (~> 0.6.1)
14
- sprockets (~> 2.0.0)
15
- activemodel (3.1.0)
16
- activesupport (= 3.1.0)
17
- bcrypt-ruby (~> 3.0.0)
18
- builder (~> 3.0.0)
19
- i18n (~> 0.6)
20
- activesupport (3.1.0)
21
- multi_json (~> 1.0)
22
- bcrypt-ruby (3.0.0)
23
- builder (3.0.0)
24
- diff-lcs (1.1.3)
25
- erubis (2.7.0)
26
- git (1.2.5)
27
- hike (1.2.1)
28
- i18n (0.6.0)
29
- jeweler (1.6.4)
30
- bundler (~> 1.0)
31
- git (>= 1.2.5)
32
- rake
33
- json (1.5.4)
34
- multi_json (1.0.3)
35
- rack (1.3.2)
36
- rack-cache (1.0.3)
37
- rack (>= 0.4)
38
- rack-mount (0.8.3)
39
- rack (>= 1.0.0)
40
- rack-test (0.6.1)
41
- rack (>= 1.0)
42
- rake (0.9.2)
43
- reek (1.2.8)
44
- ruby2ruby (~> 1.2)
45
- ruby_parser (~> 2.0)
46
- sexp_processor (~> 3.0)
47
- roodi (2.1.0)
48
- ruby_parser
49
- rspec (2.3.0)
50
- rspec-core (~> 2.3.0)
51
- rspec-expectations (~> 2.3.0)
52
- rspec-mocks (~> 2.3.0)
53
- rspec-core (2.3.1)
54
- rspec-expectations (2.3.0)
55
- diff-lcs (~> 1.1.2)
56
- rspec-mocks (2.3.0)
57
- ruby2ruby (1.3.0)
58
- ruby_parser (~> 2.0)
59
- sexp_processor (~> 3.0)
60
- ruby_parser (2.3.0)
61
- sexp_processor (~> 3.0)
62
- sexp_processor (3.0.6)
63
- sprockets (2.0.0)
64
- hike (~> 1.2)
65
- rack (~> 1.0)
66
- tilt (!= 1.3.0, ~> 1.1)
67
- tilt (1.3.3)
68
- yard (0.6.8)
69
-
70
- PLATFORMS
71
- ruby
72
-
73
- DEPENDENCIES
74
- actionpack
75
- activesupport
76
- bundler (~> 1.0.0)
77
- jeweler (~> 1.6.4)
78
- json
79
- reek (~> 1.2.8)
80
- roodi (~> 2.1.0)
81
- rspec (~> 2.3.0)
82
- yard (~> 0.6.0)
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (3.1.3)
5
+ actionpack (= 3.1.3)
6
+ mail (~> 2.3.0)
7
+ actionpack (3.1.3)
8
+ activemodel (= 3.1.3)
9
+ activesupport (= 3.1.3)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ i18n (~> 0.6)
13
+ rack (~> 1.3.5)
14
+ rack-cache (~> 1.1)
15
+ rack-mount (~> 0.8.2)
16
+ rack-test (~> 0.6.1)
17
+ sprockets (~> 2.0.3)
18
+ activemodel (3.1.3)
19
+ activesupport (= 3.1.3)
20
+ builder (~> 3.0.0)
21
+ i18n (~> 0.6)
22
+ activerecord (3.1.3)
23
+ activemodel (= 3.1.3)
24
+ activesupport (= 3.1.3)
25
+ arel (~> 2.2.1)
26
+ tzinfo (~> 0.3.29)
27
+ activeresource (3.1.3)
28
+ activemodel (= 3.1.3)
29
+ activesupport (= 3.1.3)
30
+ activesupport (3.1.3)
31
+ multi_json (~> 1.0)
32
+ arel (2.2.1)
33
+ builder (3.0.0)
34
+ diff-lcs (1.1.3)
35
+ erubis (2.7.0)
36
+ git (1.2.5)
37
+ hike (1.2.1)
38
+ i18n (0.6.0)
39
+ jeweler (1.6.4)
40
+ bundler (~> 1.0)
41
+ git (>= 1.2.5)
42
+ rake
43
+ json (1.6.4)
44
+ mail (2.3.0)
45
+ i18n (>= 0.4.0)
46
+ mime-types (~> 1.16)
47
+ treetop (~> 1.4.8)
48
+ mime-types (1.17.2)
49
+ multi_json (1.0.4)
50
+ polyglot (0.3.3)
51
+ rack (1.3.6)
52
+ rack-cache (1.1)
53
+ rack (>= 0.4)
54
+ rack-mount (0.8.3)
55
+ rack (>= 1.0.0)
56
+ rack-ssl (1.3.2)
57
+ rack
58
+ rack-test (0.6.1)
59
+ rack (>= 1.0)
60
+ rails (3.1.3)
61
+ actionmailer (= 3.1.3)
62
+ actionpack (= 3.1.3)
63
+ activerecord (= 3.1.3)
64
+ activeresource (= 3.1.3)
65
+ activesupport (= 3.1.3)
66
+ bundler (~> 1.0)
67
+ railties (= 3.1.3)
68
+ railties (3.1.3)
69
+ actionpack (= 3.1.3)
70
+ activesupport (= 3.1.3)
71
+ rack-ssl (~> 1.3.2)
72
+ rake (>= 0.8.7)
73
+ rdoc (~> 3.4)
74
+ thor (~> 0.14.6)
75
+ rake (0.9.2.2)
76
+ rdoc (3.12)
77
+ json (~> 1.4)
78
+ reek (1.2.8)
79
+ ruby2ruby (~> 1.2)
80
+ ruby_parser (~> 2.0)
81
+ sexp_processor (~> 3.0)
82
+ roodi (2.1.0)
83
+ ruby_parser
84
+ rspec (2.8.0)
85
+ rspec-core (~> 2.8.0)
86
+ rspec-expectations (~> 2.8.0)
87
+ rspec-mocks (~> 2.8.0)
88
+ rspec-core (2.8.0)
89
+ rspec-expectations (2.8.0)
90
+ diff-lcs (~> 1.1.2)
91
+ rspec-mocks (2.8.0)
92
+ ruby2ruby (1.3.1)
93
+ ruby_parser (~> 2.0)
94
+ sexp_processor (~> 3.0)
95
+ ruby_parser (2.3.1)
96
+ sexp_processor (~> 3.0)
97
+ sexp_processor (3.0.10)
98
+ sprockets (2.0.3)
99
+ hike (~> 1.2)
100
+ rack (~> 1.0)
101
+ tilt (~> 1.1, != 1.3.0)
102
+ thor (0.14.6)
103
+ tilt (1.3.3)
104
+ treetop (1.4.10)
105
+ polyglot
106
+ polyglot (>= 0.3.1)
107
+ tzinfo (0.3.31)
108
+ yard (0.7.4)
109
+
110
+ PLATFORMS
111
+ ruby
112
+
113
+ DEPENDENCIES
114
+ bundler (~> 1.0.21)
115
+ jeweler (~> 1.6.4)
116
+ json
117
+ rails (> 3.0)
118
+ reek (~> 1.2.8)
119
+ roodi (~> 2.1.0)
120
+ rspec (~> 2.8.0)
121
+ yard (~> 0.7.4)
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- Copyright (c) 2007-2010 Pivotal Labs
2
- Copyright (c) 2011 Peter H. Boling (http://peterboling.com)
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining
5
- a copy of this software and associated documentation files (the
6
- "Software"), to deal in the Software without restriction, including
7
- without limitation the rights to use, copy, modify, merge, publish,
8
- distribute, sublicense, and/or sell copies of the Software, and to
9
- permit persons to whom the Software is furnished to do so, subject to
10
- the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2007-2010 Pivotal Labs
2
+ Copyright (c) 2011 Peter H. Boling (http://peterboling.com)
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc CHANGED
@@ -1,159 +1,158 @@
1
- CacheableFlash
2
- ==============
3
-
4
- Note: This fork (http://github.com/pboling/cacheable-flash/tree/master) of
5
- cacheable-flash aims to be a drop-in replacement for the original cacheable-flash
6
- (by Pivotal) but uses JQuery instead of Prototype, and merged several of the forks
7
- of the project to collect the best features and improvements. It has also been made
8
- compatible with Rails 3, hooked into the asset pipeline for rails 3.1, and turned into a gem.
9
-
10
- == Installation as plugin
11
-
12
- ruby script/plugin install git://github.com/pboling/cacheable-flash.git
13
-
14
- == Installation as gem
15
-
16
- gem install 'cacheable_flash'
17
-
18
- add to your Gemfile:
19
- gem 'cacheable_flash'
20
-
21
- == Setup
22
-
23
- === Without asset pipeline, or pre-Rails 3.1:
24
-
25
- First copy the JS assets into your app:
26
- rails generate cacheable_flash:install
27
-
28
- CacheableFlash adds its javascript dependencies as a Rails 3 javascript 'expansion',
29
- which are only used if you are NOT using the asset pipeline (apparently?).
30
-
31
- So if you have config.assets.enabled = false in application.rb then in your layout:
32
- javascript_include_tag :cacheable_flash
33
-
34
- Otherwise, in your layout, just source them like normal:
35
- javascript_include_tag 'flash', 'jquery.cookie'
36
-
37
- === With asset pipeline (requires Rails 3.1)
38
-
39
- The asset pipeline should have access to the assets in this gem via your app/assets/application.js:
40
- //= require flash
41
- //= require jquery.cookie
42
-
43
- == Description
44
-
45
- This plugin enables greater levels of page caching by rendering flash
46
- messages from a cookie using JavaScript, instead of in your Rails
47
- view template. Flash contents are converted to JSON and placed in
48
- a cookie by an after_filter in a controller.
49
-
50
- == Mailing List
51
-
52
- http://groups.google.com/group/PivotalLabsOpenSource
53
- *This mailing list is for the original CacheableFlash, and may not be able to help with issues with this gem.
54
-
55
- == Bug/Feature Tracker
56
-
57
- https://github.com/pboling/cacheable-flash/issues
58
-
59
- == Wiki
60
-
61
- Please help document!
62
-
63
- https://github.com/pboling/cacheable-flash/wiki
64
-
65
- === Usage
66
-
67
- To use, include the CacheableFlash module in your controller.
68
- It's all or none on the actions in your controller, so you can't
69
- mix JS and HTML display of your flash message in a controller.
70
- No other modifications to the controller are needed. You will need
71
- to add divs and some javascript to your view or layout templates
72
- to render the flash in the browser.
73
-
74
- Note that the cookie holding the flash messages is removed as the
75
- page is displayed, so a refresh will clear the flash message (just
76
- as happens normally).
77
-
78
- === Example Controller
79
-
80
- class MyController < ActionController::Base
81
- include CacheableFlash
82
- # ...
83
- end
84
-
85
- === Example Template Markup
86
-
87
- <div id="error_div_id" class="flash flash_error"></div>
88
- <div id="notice_div_id" class="flash flash_notice"></div>
89
- <script type="text/javascript">
90
- Flash.transferFromCookies();
91
- Flash.writeDataTo('error', $('#error_div_id'));
92
- Flash.writeDataTo('notice', $('#notice_div_id'));
93
- </script>
94
-
95
- == Testing
96
- You can test your flash cookies by making assertions on the json of the "flash" cookie.
97
- Cacheable Flash provides test helpers which includes the flash_cookie method.
98
-
99
- === Test::Unit Example
100
- require "cacheable_flash/test_helpers"
101
-
102
- class TestController < ActionController::Base
103
- def index
104
- flash["notice"] = "In index"
105
- end
106
- end
107
-
108
- class ControllerTest < Test::Unit::TestCase
109
- include CacheableFlash::TestHelpers
110
-
111
- def setup
112
- @controller = TestController.new
113
- @request = ActionController::TestRequest.new
114
- @response = ActionController::TestResponse.new
115
- end
116
-
117
- def test_cacheable_flash_action
118
- get :index
119
- asset_equal "In index", flash_cookie["notice"]
120
- end
121
- end
122
-
123
- === Rspec Example
124
- require "cacheable_flash/test_helpers"
125
-
126
- class TestController < ActionController::Base
127
- def index
128
- flash["notice"] = "In index"
129
- end
130
- end
131
-
132
- describe TestController, "#index" do
133
- include CacheableFlash::TestHelpers
134
-
135
- it "writes to the flash cookie" do
136
- get :index
137
- flash_cookie["notice"].should == "In index"
138
- end
139
- end
140
-
141
- == Contributing to cacheable-flash
142
-
143
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
144
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
145
- * Fork the project
146
- * Start a feature/bugfix branch
147
- * Commit and push until you are happy with your contribution
148
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
149
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
150
-
151
- == Copyright
152
-
153
- Licensed under the MIT License.
154
-
155
- Copyright (c) 2011 Peter H. Boling (http://peterboling.com). See LICENSE.txt for further details.
156
- Copyright (c) 2007-2010 Pivotal Labs
157
-
158
-
159
-
1
+ CacheableFlash
2
+ ==============
3
+
4
+ cacheable-flash > v0.2 (organized by Peter Boling from many of the community forks)
5
+ aims to be a drop-in replacement for the original cacheable-flash v0.1 (by Pivotal)
6
+ but uses JQuery instead of Prototype. The idea was to merge forks to collect the best features and improvements.
7
+ It has also been made compatible with Rails 3, hooked into the asset pipeline for rails 3.1, and turned into a gem.
8
+
9
+ == Installation as plugin
10
+
11
+ ruby script/plugin install git://github.com/pivotal/cacheable-flash.git
12
+
13
+ == Installation as gem
14
+
15
+ gem install 'cacheable_flash'
16
+
17
+ add to your Gemfile:
18
+ gem 'cacheable_flash'
19
+
20
+ == Setup
21
+
22
+ === Without asset pipeline, or pre-Rails 3.1:
23
+
24
+ First copy the JS assets into your app:
25
+ rails generate cacheable_flash:install
26
+
27
+ CacheableFlash adds its javascript dependencies as a Rails 3 javascript 'expansion',
28
+ which are only used if you are NOT using the asset pipeline (apparently?).
29
+
30
+ So if you have config.assets.enabled = false in application.rb then in your layout:
31
+ javascript_include_tag :cacheable_flash
32
+
33
+ Otherwise, in your layout, just source them like normal:
34
+ javascript_include_tag 'flash', 'jquery.cookie'
35
+
36
+ === With asset pipeline (requires Rails 3.1)
37
+
38
+ The asset pipeline should have access to the assets in this gem via your app/assets/javascripts/application.js:
39
+ //= require flash
40
+ //= require jquery.cookie
41
+
42
+ == Description
43
+
44
+ This plugin enables greater levels of page caching by rendering flash
45
+ messages from a cookie using JavaScript, instead of in your Rails
46
+ view template. Flash contents are converted to JSON and placed in
47
+ a cookie by an after_filter in a controller.
48
+
49
+ == Mailing List
50
+
51
+ http://groups.google.com/group/PivotalLabsOpenSource
52
+ *This mailing list is for the original CacheableFlash, and may not be able to help with issues with this gem.
53
+
54
+ == Bug/Feature Tracker
55
+
56
+ https://github.com/pivotal/cacheable-flash/issues
57
+
58
+ == Wiki
59
+
60
+ Please help document!
61
+
62
+ https://github.com/pivotal/cacheable-flash/wiki
63
+
64
+ === Usage
65
+
66
+ To use, include the CacheableFlash module in your controller.
67
+ It's all or none on the actions in your controller, so you can't
68
+ mix JS and HTML display of your flash message in a controller.
69
+ No other modifications to the controller are needed. You will need
70
+ to add divs and some javascript to your view or layout templates
71
+ to render the flash in the browser.
72
+
73
+ Note that the cookie holding the flash messages is removed as the
74
+ page is displayed, so a refresh will clear the flash message (just
75
+ as happens normally).
76
+
77
+ === Example Controller
78
+
79
+ class MyController < ActionController::Base
80
+ include CacheableFlash
81
+ # ...
82
+ end
83
+
84
+ === Example Template Markup
85
+
86
+ <div id="error_div_id" class="flash flash_error"></div>
87
+ <div id="notice_div_id" class="flash flash_notice"></div>
88
+ <script type="text/javascript">
89
+ Flash.transferFromCookies();
90
+ Flash.writeDataTo('error', $('#error_div_id'));
91
+ Flash.writeDataTo('notice', $('#notice_div_id'));
92
+ </script>
93
+
94
+ == Testing
95
+ You can test your flash cookies by making assertions on the json of the "flash" cookie.
96
+ Cacheable Flash provides test helpers which includes the flash_cookie method.
97
+
98
+ === Test::Unit Example
99
+ require "cacheable_flash/test_helpers"
100
+
101
+ class TestController < ActionController::Base
102
+ def index
103
+ flash["notice"] = "In index"
104
+ end
105
+ end
106
+
107
+ class ControllerTest < Test::Unit::TestCase
108
+ include CacheableFlash::TestHelpers
109
+
110
+ def setup
111
+ @controller = TestController.new
112
+ @request = ActionController::TestRequest.new
113
+ @response = ActionController::TestResponse.new
114
+ end
115
+
116
+ def test_cacheable_flash_action
117
+ get :index
118
+ asset_equal "In index", flash_cookie["notice"]
119
+ end
120
+ end
121
+
122
+ === Rspec Example
123
+ require "cacheable_flash/test_helpers"
124
+
125
+ class TestController < ActionController::Base
126
+ def index
127
+ flash["notice"] = "In index"
128
+ end
129
+ end
130
+
131
+ describe TestController, "#index" do
132
+ include CacheableFlash::TestHelpers
133
+
134
+ it "writes to the flash cookie" do
135
+ get :index
136
+ flash_cookie["notice"].should == "In index"
137
+ end
138
+ end
139
+
140
+ == Contributing to cacheable-flash
141
+
142
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
143
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
144
+ * Fork the project
145
+ * Start a feature/bugfix branch
146
+ * Commit and push until you are happy with your contribution
147
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
148
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
149
+
150
+ == Copyright
151
+
152
+ Licensed under the MIT License.
153
+
154
+ Copyright (c) 2011-2012 Peter H. Boling (http://peterboling.com). See LICENSE.txt (MIT license) for further details.
155
+ Copyright (c) 2007-2010 Pivotal Labs
156
+
157
+
158
+