2014-12-31 15:59:32 -05:00
|
|
|
require 'spec_helper'
|
2010-05-22 01:53:03 -04:00
|
|
|
|
2016-11-08 21:39:25 -05:00
|
|
|
RSpec.describe 'AwesomePrint ActionView extensions', skip: -> { !ExtVerifier.has_rails? }.call do
|
2014-12-31 15:59:32 -05:00
|
|
|
before do
|
2021-01-14 22:05:15 -05:00
|
|
|
@view = if rails_6_1?
|
|
|
|
ActionView::Base.new(ActionView::LookupContext.new([]), {}, {})
|
|
|
|
else
|
|
|
|
ActionView::Base.new
|
|
|
|
end
|
2014-12-31 15:59:32 -05:00
|
|
|
end
|
2010-05-22 01:53:03 -04:00
|
|
|
|
2014-12-31 15:59:32 -05:00
|
|
|
it "uses HTML and adds 'debug_dump' class to plain <pre> tag" do
|
|
|
|
markup = rand
|
2016-11-08 09:53:17 -05:00
|
|
|
expect(@view.ap(markup, plain: true)).to eq(%Q|<pre class="debug_dump">#{markup}</pre>|)
|
2010-05-22 01:53:03 -04:00
|
|
|
end
|
2011-05-04 20:55:31 -04:00
|
|
|
|
2014-12-31 15:59:32 -05:00
|
|
|
it "uses HTML and adds 'debug_dump' class to colorized <pre> tag" do
|
|
|
|
markup = ' &<hello>'
|
|
|
|
expect(@view.ap(markup)).to eq('<pre class="debug_dump"><kbd style="color:brown">" &<hello>"</kbd></pre>')
|
|
|
|
end
|
2010-05-22 01:53:03 -04:00
|
|
|
end
|