diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..2b70699 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + +gem 'jeweler2' +gem 'sinatra', '<=1.3.2' +gem 'bacon' +gem 'rack-test' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..7e24afb --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,26 @@ +GEM + remote: https://rubygems.org/ + specs: + bacon (1.2.0) + git (1.2.6) + jeweler2 (2.0.9) + git (>= 1.2.5) + rack (1.5.2) + rack-protection (1.5.1) + rack + rack-test (0.6.2) + rack (>= 1.0) + sinatra (1.3.2) + rack (~> 1.3, >= 1.3.6) + rack-protection (~> 1.2) + tilt (~> 1.3, >= 1.3.3) + tilt (1.4.1) + +PLATFORMS + ruby + +DEPENDENCIES + bacon + jeweler2 + rack-test + sinatra (<= 1.3.2) diff --git a/lib/rack/flash.rb b/lib/rack/flash.rb index 6b2935a..7ad70b0 100644 --- a/lib/rack/flash.rb +++ b/lib/rack/flash.rb @@ -21,6 +21,10 @@ def initialize(store, opts={}) end end + def each &block + values.each &block + end + # Remove an entry from the session and return its value. Cache result in # the instance cache. def [](key) diff --git a/test/test_flash.rb b/test/test_flash.rb index a670940..3d155a4 100644 --- a/test/test_flash.rb +++ b/test/test_flash.rb @@ -1,7 +1,7 @@ require File.dirname(__FILE__) + '/helper' describe 'Rack::Flash' do - include Rack::Test::Methods + extend Rack::Test::Methods def app(&block) return Sinatra.new &block @@ -17,6 +17,10 @@ def new_flash(entries={}) flash end + it 'responds to each' do + new_flash.methods.should.include(:each) + end + it 'stores entries' do new_flash[:foo] = 'bar' new_flash[:foo].should.equal('bar')