rack-piwik 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/test/test_rack_piwik.rb +14 -5
- metadata +1 -1
data/test/test_rack_piwik.rb
CHANGED
@@ -7,10 +7,10 @@ class TestRackPiwik < Test::Unit::TestCase
|
|
7
7
|
setup { mock_app :async => true, :tracker => 'somebody', :piwik_url => 'piwik.example.org', :piwik_id => '123' }
|
8
8
|
should "add tracker if body element is present" do
|
9
9
|
get "/body_only"
|
10
|
-
assert_match
|
11
|
-
assert_match
|
12
|
-
assert_match %r{</noscript>\n<!-- End Piwik
|
13
|
-
assert_equal
|
10
|
+
assert_match 'http://piwik.example.org/', last_response.body
|
11
|
+
assert_match '_paq.push(["setSiteId", "123"]);', last_response.body
|
12
|
+
assert_match %r{</noscript>\n<!-- End Piwik --></body>}, last_response.body
|
13
|
+
assert_equal 787, last_response.headers['Content-Length'].to_i
|
14
14
|
end
|
15
15
|
|
16
16
|
should "omit 404 tracking for other responses with other status" do
|
@@ -44,7 +44,16 @@ class TestRackPiwik < Test::Unit::TestCase
|
|
44
44
|
|
45
45
|
=begin
|
46
46
|
context "Synchronous" do
|
47
|
-
setup { mock_app :async => false, :tracker => '
|
47
|
+
setup { mock_app :async => false, :tracker => 'somebody', :piwik_url => 'piwik.example.org', :piwik_id => '123' }
|
48
|
+
|
49
|
+
should "add tracker if body element is present" do
|
50
|
+
get "/body_only"
|
51
|
+
assert_match %r{https://piwik.example.org/}, last_response.body
|
52
|
+
assert_match %r{123\);}, last_response.body
|
53
|
+
assert_match %r{</noscript>\n<!-- End Piwik --></body>}, last_response.body
|
54
|
+
assert_equal "650", last_response.headers['Content-Length']
|
55
|
+
end
|
56
|
+
|
48
57
|
should "show non-asynchronous tracker" do
|
49
58
|
get "/bob"
|
50
59
|
assert_match %r{.getTracker}, last_response.body
|