Sha256: 7a12e67d68819c15935511513041c7595132bb4199b5c6bfa67a85ae4de4ea50

Contents?: true

Size: 920 Bytes

Versions: 1

Compression:

Stored size: 920 Bytes

Contents

require 'spec_helper'

describe GoogleAnalyticsMailer::UrlFor do

  before(:each) do
    controller.stub(computed_analytics_params: {utm_source: 'foo'})
    controller.class.stub(google_analytics_filter: nil)
  end

  describe '#with_google_analytics_params' do

    it 'should override used parameters while in the block' do
      helper.with_google_analytics_params utm_source: 'bar' do
        helper.url_for('http://www.example.com').should include 'utm_source=bar'
      end
      helper.url_for('http://www.example.com').should include 'utm_source=foo'
    end

  end

  describe '#without_google_analytics_params' do

    it 'should ignore analytic params in the block' do
      helper.without_google_analytics_params do
        helper.url_for('http://www.example.com').should == 'http://www.example.com'
      end
      helper.url_for('http://www.example.com').should include 'utm_source=foo'
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google_analytics_mailer-0.3.0 spec/helpers/url_for_spec.rb