From 1662e3436157a5453deadd3704540adf9864920d Mon Sep 17 00:00:00 2001 From: andrea longhi Date: Fri, 6 Dec 2013 11:07:37 +0100 Subject: [PATCH 1/4] add Gemfile --- Gemfile | 6 ++++++ Gemfile.lock | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ef0ac76 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source 'https://rubygems.org' + + +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..ed25c47 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,22 @@ +GEM + remote: https://rubygems.org/ + specs: + bacon (1.2.0) + 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 + rack-test + sinatra (<= 1.3.2) From 6d23a09991b1d3c84c0821564460cf7d8462ba1a Mon Sep 17 00:00:00 2001 From: andrea longhi Date: Fri, 6 Dec 2013 11:08:17 +0100 Subject: [PATCH 2/4] fix test_flash.rb as per https://github.com/chneukirchen/bacon/issues/4 --- test/test_flash.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_flash.rb b/test/test_flash.rb index a670940..4b304f3 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 From 627db2065a60213e9102e4af6764b616bb1d9af0 Mon Sep 17 00:00:00 2001 From: andrea longhi Date: Fri, 6 Dec 2013 11:12:38 +0100 Subject: [PATCH 3/4] add jeweler2 gem as per rake test request --- Gemfile | 2 +- Gemfile.lock | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index ef0ac76..2b70699 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +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 index ed25c47..7e24afb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,6 +2,9 @@ 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 @@ -18,5 +21,6 @@ PLATFORMS DEPENDENCIES bacon + jeweler2 rack-test sinatra (<= 1.3.2) From f74a18d4a652efe0e4fd5467957f9846878775b7 Mon Sep 17 00:00:00 2001 From: andrea longhi Date: Fri, 6 Dec 2013 11:17:47 +0100 Subject: [PATCH 4/4] add FlashHash#each method --- lib/rack/flash.rb | 4 ++++ test/test_flash.rb | 4 ++++ 2 files changed, 8 insertions(+) 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 4b304f3..3d155a4 100644 --- a/test/test_flash.rb +++ b/test/test_flash.rb @@ -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')