Sha256: 2b42062f6f55a7e090ff29fd4f6ed460c8199294016f5bcefe47e445833dbb14

Contents?: true

Size: 642 Bytes

Versions: 2

Compression:

Stored size: 642 Bytes

Contents

require 'test_helper'

class ViewTest < ActionView::TestCase

  test 'tag' do
    self.request = ActionDispatch::TestRequest.new

    with_env 'production' do
      tag = google_adsense_include_tag(client: 'pub-1234', width: 728)
      assert_includes tag, %Q(google_ad_client = "pub-1234";\ngoogle_ad_width = 728;)
    end

    with_env 'development' do
      tag = google_adsense_include_tag(width: 728, height:90)
      assert_includes tag, 'style="width: 728px; height: 90px; background: #c8c8c8;"'
    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
ads-rails-4.0.0.1 test/view_test.rb
ads-rails-4.0.0.0 test/view_test.rb