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
|
2010-05-22 01:53:03 -04:00
|
|
|
|
2014-12-31 15:59:32 -05:00
|
|
|
before do
|
|
|
|
@view = ActionView::Base.new
|
|
|
|
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
|