All helpers are included in helper object for helper specs, despite clear_helpers
It seems that the "helper" object inside helper specs has all helper modules included into it, despite having clear_helpers in ApplicationController.
I setup a small test app using rails 3.0.5, rspec-rails 2.5. In it, I edited my ApplicationController to call "clear_helpers."
I then created two helpers:
app/helpers/bar_helper.rb:
module BarHelper
def bar
"I am the bar helper"
end
end
app/helpers/foo_helper.rb:
module FooHelper
def bar
"I am the foo helper"
end
end
Then I setup the following spec in spec/helpers/bar_helper_spec.rb:
require "spec_helper"
describe BarHelper do
it "should be the bar helper" do
helper.bar.should == "I am the bar helper"
end
end
When run, it fails with:
Failures:
1) BarHelper should be the bar helper
Failure/Error: helper.bar.should == "I am the bar helper"
expected: "I am the bar helper"
got: "I am the foo helper" (using ==)
# ./spec/helpers/bar_helper_spec.rb:5
It seems that FooHelper is included in the helper object. Is there any way to "clear_helpers" for rspec's helper object?
Thanks!