Sha256: d3689bcb1df2df4cb3d54bc41f28a77f1d7ce2632f1dee4d4da60d7375b89712

Contents?: true

Size: 650 Bytes

Versions: 2

Compression:

Stored size: 650 Bytes

Contents

require 'test_helper'

class IncludeTagTest < ActionView::TestCase

  test 'tag id' do
    with_env 'production' do
      assert google_analytics_include_tag('id').include?("_gaq.push(['_setAccount', 'id']);")

      assert google_analytics_include_tag(
        variables: [[1, 'Member', 'Yes', 1]]
      ).include?("_gaq.push(['_setCustomVar', 1, 'Member', 'Yes', 1])")

      assert google_analytics_include_tag(
        events: [['Popup', 'Click']]
      ).include?("ga('send', 'event', 'Popup', 'Click');")
    end
  end

  private

  def with_env(value)
    old_env = Rails.env
    Rails.env = value
    yield
    Rails.env = old_env
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
analytics-rails-0.2.1 test/include_tag_test.rb
analytics-rails-0.2.0 test/include_tag_test.rb