Skip to content

Commit

Permalink
to_prepare block is not called on every request
Browse files Browse the repository at this point in the history
  • Loading branch information
sigmike committed Jul 25, 2012
1 parent 6b7d26c commit 8841e2a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions railties/test/railties/railtie_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ class Foo < Rails::Railtie
end

test "railtie can add to_prepare callbacks" do
$to_prepare = false
class Foo < Rails::Railtie ; config.to_prepare { $to_prepare = true } ; end
assert !$to_prepare
$to_prepare = 0
class Foo < Rails::Railtie ; config.to_prepare { $to_prepare += 1 } ; end
assert_equal 0, $to_prepare
require "#{app_path}/config/environment"
require "rack/test"
extend Rack::Test::Methods
get "/"
assert $to_prepare
assert_equal 1, $to_prepare
get "/"
assert_equal 2, $to_prepare
end

test "railtie can add after_initialize callbacks" do
Expand Down

1 comment on commit 8841e2a

@zhelee
Copy link

@zhelee zhelee commented on 8841e2a Aug 26, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ouvrages have you fix this problem, I met the same problem

Please sign in to comment.