Sha256: ccb7bbc68d510c3a39c08023a69a38c7c2d822f9acc7d60e88612f0fd4a305b6

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

require 'hoptoad_notifier/rails/javascript_notifier'

class JavascriptNotifierTest < Test::Unit::TestCase
  
  def self.after_filter(arg); end
  include ::HoptoadNotifier::Rails::JavascriptNotifier

  should "insert javascript after head" do
    input_body =<<-EOS
<html><head><title></title></head><body></body></html>
    EOS
    javascript = "js-code"
    expected =<<-EOS
<html><head>
js-code
<title></title></head><body></body></html>
    EOS
    output = send :insert_javascript_after_head, input_body, javascript
    assert_equal expected, output
  end

  should "insert javascript after head when head has attributes" do
    input_body =<<-EOS
<html><head lang="en"><title></title></head><body></body></html>
    EOS
    javascript = "js-code"
    expected =<<-EOS
<html><head lang="en">
js-code
<title></title></head><body></body></html>
    EOS
    output = send :insert_javascript_after_head, input_body, javascript
    assert_equal expected, output
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hoptoad_notifier-2.4.2 test/javascript_notifier_test.rb