Skip to content

Commit

Permalink
test (failing) that filters not run when serving static files
Browse files Browse the repository at this point in the history
  • Loading branch information
rtomayko committed Jan 28, 2010
1 parent 70edb20 commit ae8ac8f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/filter_test.rb
Expand Up @@ -108,6 +108,19 @@ class BeforeFilterTest < Test::Unit::TestCase
get '/foo'
assert_equal 'hello from superclass', body
end

it 'does not run before filter when serving static files' do
ran_filter = false
mock_app {
before { ran_filter = true }
set :static, true
set :public, File.dirname(__FILE__)
}
get "/#{File.basename(__FILE__)}"
assert ok?
assert_equal File.read(__FILE__), body
assert !ran_filter
end
end

class AfterFilterTest < Test::Unit::TestCase
Expand Down Expand Up @@ -192,4 +205,17 @@ class AfterFilterTest < Test::Unit::TestCase
get '/foo'
assert_equal 8, count
end

it 'does not run after filter when serving static files' do
ran_filter = false
mock_app {
after { ran_filter = true }
set :static, true
set :public, File.dirname(__FILE__)
}
get "/#{File.basename(__FILE__)}"
assert ok?
assert_equal File.read(__FILE__), body
assert !ran_filter
end
end

0 comments on commit ae8ac8f

Please sign in to comment.