Sha256: e15cb61a6292b1d05f0e6970fde494ef82268f83b4bc44683226feb1580d5f5f
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' describe GoogleAnalyticsMailer::UriBuilder do describe '#build' do it 'should not include blank GA params' do subject.build('http://www.example.com', utm_campaign: nil).should_not include 'utm_campaign' end it 'should uri encode GA parameter values' do subject.build('http://www.example.com', utm_campaign: 'Foo Bar').should include 'utm_campaign=Foo%20Bar' end it 'should not add GA parameters if uri is not absolute' do subject.build('/some/path', utm_campaign: 'abc').should == '/some/path' end it 'should not touch uri with empty params' do subject.build('http://www.example.com', {}).should == 'http://www.example.com' end context 'with a filter' do subject { GoogleAnalyticsMailer::UriBuilder.new ->(uri) { uri.host == 'www.example.com' } } it 'should add GA parameters to URIs that match the filter' do subject.build('http://www.example.com', utm_campaign: 'Foo Bar').should include 'utm_campaign=Foo%20Bar' end it 'should not add GA parameters to URIs that do not match the filter' do subject.build('http://www.external.com', utm_campaign: 'Foo Bar').should_not include 'utm_campaign=Foo%20Bar' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
google_analytics_mailer-0.3.0 | spec/lib/uri_builder_spec.rb |