2011-05-13 19:37:24 -04:00
|
|
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2010-05-22 01:53:03 -04:00
|
|
|
|
2011-05-04 20:55:31 -04:00
|
|
|
begin
|
|
|
|
require 'action_view'
|
2011-05-13 19:37:24 -04:00
|
|
|
require 'awesome_print/ext/action_view'
|
2010-05-22 01:53:03 -04:00
|
|
|
|
2011-05-13 19:37:24 -04:00
|
|
|
describe "AwesomePrint ActionView extensions" do
|
2011-05-13 19:24:01 -04:00
|
|
|
before do
|
2011-05-04 20:55:31 -04:00
|
|
|
@view = ActionView::Base.new
|
|
|
|
end
|
2010-05-22 01:53:03 -04:00
|
|
|
|
2011-05-07 14:50:04 -04:00
|
|
|
it "uses HTML and adds 'debug_dump' class to plain <pre> tag" do
|
|
|
|
markup = rand
|
|
|
|
@view.ap(markup, :plain => true).should == %Q|<pre class="debug_dump">#{markup}</pre>|
|
2010-05-22 01:53:03 -04:00
|
|
|
end
|
|
|
|
|
2011-05-07 14:50:04 -04:00
|
|
|
it "uses HTML and adds 'debug_dump' class to colorized <pre> tag" do
|
|
|
|
markup = ' &<hello>'
|
2011-11-24 00:10:56 -05:00
|
|
|
@view.ap(markup).should == '<pre class="debug_dump"><kbd style="color:brown">" &<hello>"</kbd></pre>'
|
2010-05-22 01:53:03 -04:00
|
|
|
end
|
|
|
|
end
|
2011-05-04 20:55:31 -04:00
|
|
|
|
2011-11-24 00:33:03 -05:00
|
|
|
rescue LoadError => error
|
|
|
|
puts "Skipping ActionView specs: #{error}"
|
2010-05-22 01:53:03 -04:00
|
|
|
end
|