Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Don't awesome print Capybara elements.

Capybara elements are huge and take quite a long time to output.
One pretty much never wants to awesome print them.

/ht @nathanaelkane
  • Loading branch information...
commit e88952133cfa2de6a829a7b1e91464f7f48bf3ed 1 parent f1149dc
@jasoncodes authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 pryrc
View
9 pryrc
@@ -43,8 +43,13 @@ org_print = Pry.config.print
Pry.config.print = proc do |output, value|
begin
require 'awesome_print'
- value = value.to_a if defined?(ActiveRecord) && defined?(ActiveRecord::Relation) && value.is_a?(ActiveRecord::Relation)
- output.puts value.ai
+ case
+ when defined?(Capybara) && value.is_a?(Capybara::Node::Element)
+ org_print.call(output, value)
+ else
+ value = value.to_a if defined?(ActiveRecord) && defined?(ActiveRecord::Relation) && value.is_a?(ActiveRecord::Relation)
+ output.puts value.ai
+ end
rescue LoadError => err
org_print.call(output, value)
end
Please sign in to comment.
Something went wrong with that request. Please try again.