Skip to content

Commit

Permalink
Update tests for HTML escape features
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-rikowski committed Feb 6, 2021
1 parent be14143 commit acf7abd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/ext/action_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
expect(@view.ap(markup)).to eq('<pre class="debug_dump"><kbd style="color:brown">&quot; &amp;&lt;hello&gt;&quot;</kbd></pre>')
end

it 'users HTML and does not set output to HTML safe' do
expect(@view.ap('<p>Hello World</p>')).not_to be_html_safe
it 'uses HTML and does set output to HTML safe' do
expect(@view.ap('<p>Hello World</p>')).to be_html_safe
end
end
5 changes: 5 additions & 0 deletions spec/ext/active_record_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ class SubUser < User {
it 'should print ActiveRecord::Base objects (ex. ancestors)' do
expect { @ap.awesome(User.ancestors) }.not_to raise_error
end

it 'should print valid HTML for subclasses' do
@ap = AmazingPrint::Inspector.new(html: true)
expect(@ap.awesome(SubUser)).to match('SubUser &lt; User')
end
end

#------------------------------------------------------------------------------
Expand Down

0 comments on commit acf7abd

Please sign in to comment.