Created
January 4, 2011 03:21
-
-
Save mtodd/764340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 6025b58e00cc93501049f1ad43b0a1d16ba69c86 | |
Author: Matt Todd <[email protected]> | |
Date: Mon Jan 3 22:05:15 2011 -0500 | |
Add failing spec for filters missing route params | |
diff --git a/test/filter_test.rb b/test/filter_test.rb | |
index ef7e9ae..e4d1966 100644 | |
--- a/test/filter_test.rb | |
+++ b/test/filter_test.rb | |
@@ -97,6 +97,17 @@ class BeforeFilterTest < Test::Unit::TestCase | |
assert_equal 'cool', body | |
end | |
+ it "gives you access to params from routes" do | |
+ mock_app { | |
+ before { @foo = params['foo'] } | |
+ get('/:foo'){ @foo } | |
+ } | |
+ | |
+ get '/bar' | |
+ assert ok? | |
+ assert_equal 'bar', body | |
+ end | |
+ | |
it "runs filters defined in superclasses" do | |
base = Class.new(Sinatra::Base) | |
base.before { @foo = 'hello from superclass' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment