lib/spec/rails/example/view_example_group.rb in rspec-rails-1.2.4 vs lib/spec/rails/example/view_example_group.rb in rspec-rails-1.2.5
- old
+ new
@@ -45,9 +45,22 @@
# with_tag("input[type=submit][value=Login]")
# end
# end
# end
class ViewExampleGroup < FunctionalExampleGroup
+ if ActionView::Base.respond_to?(:load_helpers) # Rails 2.0.x
+ ActionView::Helpers.constants.each do |name|
+ const = ActionView::Helpers.const_get(name)
+ include const if name.include?("Helper") && Module === const
+ end
+ elsif ActionView::Base.respond_to?(:helper_modules) # Rails 2.1.x
+ ActionView::Base.helper_modules.each do |helper_module|
+ include helper_module
+ end
+ else # Rails 2.2.x
+ include ActionView::Helpers
+ end
+
tests ViewExampleGroupController
class << self
def inherited(klass) # :nodoc:
klass.subject { template }
super