1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00
awesome_print/spec/ext/action_view_spec.rb

25 lines
775 B
Ruby

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
begin
require 'action_view'
require 'awesome_print/ext/action_view'
describe "AwesomePrint ActionView extensions" do
before do
@view = ActionView::Base.new
end
it "uses HTML and adds 'debug_dump' class to plain <pre> tag" do
markup = rand
expect(@view.ap(markup, :plain => true)).to eq(%Q|<pre class="debug_dump">#{markup}</pre>|)
end
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">&quot; &amp;&lt;hello&gt;&quot;</kbd></pre>')
end
end
rescue LoadError => error
puts "Skipping ActionView specs: #{error}"
end