2014-12-31 18:59:32 -02:00
|
|
|
require 'spec_helper'
|
2010-05-21 22:53:03 -07:00
|
|
|
|
2016-11-09 13:39:25 +11:00
|
|
|
RSpec.describe 'AwesomePrint ActionView extensions', skip: -> { !ExtVerifier.has_rails? }.call do
|
2010-05-21 22:53:03 -07:00
|
|
|
|
2014-12-31 18:59:32 -02:00
|
|
|
before do
|
|
|
|
@view = ActionView::Base.new
|
|
|
|
end
|
2010-05-21 22:53:03 -07:00
|
|
|
|
2014-12-31 18:59:32 -02:00
|
|
|
it "uses HTML and adds 'debug_dump' class to plain <pre> tag" do
|
|
|
|
markup = rand
|
2016-11-09 01:53:17 +11:00
|
|
|
expect(@view.ap(markup, plain: true)).to eq(%Q|<pre class="debug_dump">#{markup}</pre>|)
|
2010-05-21 22:53:03 -07:00
|
|
|
end
|
2011-05-04 17:55:31 -07:00
|
|
|
|
2014-12-31 18:59:32 -02: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-21 22:53:03 -07:00
|
|
|
end
|