Sha256: 88cac57b421f2ca784cf7d4cc107ce7f82ee76d9c9f07ee1a0a999037b6e30b9

Contents?: true

Size: 864 Bytes

Versions: 2

Compression:

Stored size: 864 Bytes

Contents

require 'spec_helper'

describe GoogleAnalyticsMailer::UrlFor do

  before(:each) do
    controller.stub(computed_analytics_params: {utm_source: 'foo'})
  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

2 entries across 2 versions & 1 rubygems

Version Path
google_analytics_mailer-0.2.1 spec/helpers/url_for_spec.rb
google_analytics_mailer-0.2.0 spec/helpers/url_for_spec.rb