Working on a request to add a pretty tooltip to a page (using jQuery tooltip plugin, as recommended by others on my team). Pretty tooltip is working fine, but two of the existing specs now fail, an example below:
describe 'with a discussion post containing html' do
before(:each) do
@post.update_attributes(:body => "some <strong>bold and <i>italic</i></strong> text")
assigns[:posts] = @discussion.posts.paginate(:page => 1)
render
end
it 'should strip the html tags from the post body' do
response.should say('some bold and italic text')
end
end
For completness, here is the javascript I have added to the discussions show page and the resulting rspec.
<script type="text/javascript" charset="utf-8">
$(function(){
$('#useful_item_submit').tooltip();
});
</script>
<div id="useful_item_form" >
<% form_for [flaggable, flaggable.useful_items.new] do |f| -%>
<div>
<%= f.submit "I find this useful", :title => 'Click to let others know you found this useful' %>
</div>
<% end -%>
</div>
Should I change the test to ignore the extra javascript or should I not have the javascript in the show.html.erb file?
Output from spec ============
'discussions/show.html.erb with a discussion post containing html should strip the html tags from the post body' FAILED
<"some bold and italic text"> expected but was
<"some bold and italic text\n\t\t\n $(function(){\n $('#useful_item_submit').tooltip();\n });">.
<false> is not true.