[rspec-devel] [ rspec-Patches-12719 ] rspec_on_rails should not include pagination helper

noreply at rubyforge.org noreply at rubyforge.org
Wed Aug 1 10:15:56 EDT 2007


Patches item #12719, was opened at 2007-07-31 18:05
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=12719&group_id=797

Category: rails plugin
Group: None
Status: Closed
Resolution: Accepted
Priority: 3
Submitted By: Matthijs Langenberg (mlangenberg)
Assigned to: David Chelimsky (dchelimsky)
Summary: rspec_on_rails should not include pagination helper

Initial Comment:
Pagination is being removed from Rails and is no longer being maintained. Therefor rspec_on_rails shouldn't try to include it. Currently it raises a "NameError: uninitialized constant ActionView::Helpers::PaginationHelper".

----------------------------------------------------------------------

>Comment By: Matthijs Langenberg (mlangenberg)
Date: 2007-08-01 16:15

Message:
That's just great David, I spent a hour last evening trying
to find a good way to let the examples behave different
based on the Rails version. I was already trying to stub
Rails::VERSION, and trying to check on
File.directory?("#{RAILS_ROOT}/vendor/rails"), but I just
let it go because it didn't make any sense in the end.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-08-01 13:27

Message:
Applied to trunk r2189.

I modified it so PaginationHelper is only included if it is found (rather than just commenting it), and also modified the spec so it expects PaginationHelper for anything <= 1.2.3.

----------------------------------------------------------------------

Comment By: Carl Porth (badcarl)
Date: 2007-07-31 21:56

Message:
Why not use the same kind of functionality that ActionView::Base uses to load the helpers?  In rails/actionpack/lib/action_view/base.rb there is the method:

def self.load_helpers #:nodoc:
  Dir.entries("#{File.dirname(__FILE__)}/helpers").sort.each do |file|
    next unless file =~ /^([a-z][a-z_]*_helper).rb$/
    require "action_view/helpers/#{$1}"
    helper_module_name = $1.camelize
    if Helpers.const_defined?(helper_module_name)
      include Helpers.const_get(helper_module_name)
    end
  end
end



----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-07-31 20:08

Message:
Please.

Thanks.

----------------------------------------------------------------------

Comment By: Matthijs Langenberg (mlangenberg)
Date: 2007-07-31 20:05

Message:
Oops, just overlooked the fact that the RSpec trunk is going
to be used with rails versions other than the current edge.
If you want I'll try to search for a solution, because I
need it to work with edge rails anyway.

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-07-31 18:08

Message:
We'll need it to remain included for Rails 1.2.1-1.2.3.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=12719&group_id=797


More information about the rspec-devel mailing list