Changeset 18893 for platform/tdiary/spec

Show
Ignore:
Timestamp:
09/05/08 16:43:45 (3 months ago)
Author:
hsbt
Message:

fix latest specification for google_analytics.rb

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/spec/google_analytics_spec.rb

    r6813 r18893  
    33 
    44describe "google_analytics plugin" do 
    5         def setup_google_analytics_plugin(profile_id) 
     5        def setup_google_analytics_plugin(profile_id, mode) 
    66                fake_plugin(:google_analytics) { |plugin| 
     7                        plugin.mode = mode 
    78                        plugin.conf['google_analytics.profile'] = profile_id 
    89                } 
     
    1112        describe "should render javascript" do 
    1213                before do 
    13                         @plugin = setup_google_analytics_plugin('53836-1') 
     14                        @plugin = setup_google_analytics_plugin('53836-1', 'latest') 
    1415                end 
    1516                 
     
    2021        end 
    2122 
     23        describe "should render javascript" do 
     24                before do 
     25                        @plugin = setup_google_analytics_plugin('53836-1', 'conf') 
     26                end 
     27                 
     28                it "for footer" do 
     29                        snippet = @plugin.footer_proc 
     30                        snippet.should be_empty 
     31                end 
     32        end 
     33 
    2234        describe "should not render when profile_id is empty" do 
    2335                before do 
    24                         @plugin = setup_google_analytics_plugin(nil) 
     36                        @plugin = setup_google_analytics_plugin(nil, 'latest') 
    2537                end 
    2638                 
     
    3345        def expected_html_footer_snippet 
    3446                expected = <<-SCRIPT 
    35                 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> 
    36                 </script> 
    37                 <script type="text/javascript"> 
    38                 _uacct = "UA-53836-1"; 
    39                 urchinTracker(); 
    40                 </script> 
     47                <script type="text/javascript"><!-- 
     48                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.") ; 
     49                document.write(unescape('%3Cscript src="' + gaJsHost + 'google-analytics.com/ga.js" type="text/javascript"%3E%3C/script%3E')) ; 
     50                // --></script> 
     51                <script type="text/javascript"><!-- 
     52                var pageTracker = _gat._getTracker("UA-53836-1"); 
     53                pageTracker._initData(); 
     54                pageTracker._trackPageview(); 
     55                // --></script> 
    4156                SCRIPT 
    4257                expected.gsub( /^\t/, '' ).chomp