spec/handler/google_analytics_spec.rb in rack-tracker-1.6.0 vs spec/handler/google_analytics_spec.rb in rack-tracker-1.7.0

- old
+ new

@@ -265,6 +265,24 @@ it "will add timeouts to push read events" do expect(subject).to include %q{setTimeout(function() { ga('send', 'event', '15_seconds', 'read'); },15000)} expect(subject).to include %q{setTimeout(function() { ga('send', 'event', '30_seconds', 'read'); },30000)} end end + + describe '#pageview_url_script' do + context 'without custom pageview url script' do + subject { described_class.new(env, {} ) } + + it 'returns return the custom pageview url script' do + expect(subject.pageview_url_script).to eql ("window.location.pathname + window.location.search") + end + end + + context 'with a custom pageview url script' do + subject { described_class.new(env, { pageview_url_script: "{ 'page': location.pathname + location.search + location.hash }"}) } + + it 'returns return the custom pageview url script' do + expect(subject.pageview_url_script).to eql ("{ 'page': location.pathname + location.search + location.hash }") + end + end + end end