Sha256: 3f00a22af221c8fc8cb9e5ad5b6c31694dd53f0304d888544fee3f84ba17259e
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require 'test_helper' class IncludeTagTest < ActionView::TestCase setup do self.request = OpenStruct.new(protocol: 'http://') end test 'adsense code' do Ads.config.renderer = nil with_env 'production' do assert_equal( %Q(<script type="text/javascript">google_ad_client = 'pub-1234';\ngoogle_ad_width = 728;\n</script>) + %Q(<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>), google_adsense_include_tag(client: 'pub-1234', width: 728) ) end end test 'renderer' do Ads.config.renderer = lambda { |options| tag( :img, src: "http://placehold.it/#{options[:width]}x#{options[:height]}&text=Adsense" ) } with_env 'development' do assert_equal( '<img src="http://placehold.it/728x90&text=Adsense" />', google_adsense_include_tag(width: 728, height:90) ) end end test 'gray div' do Ads.config.renderer = nil with_env 'development' do assert_equal( '<div style="width:728px;height:90px;background:#c8c8c8;"></div>', google_adsense_include_tag(width: 728, height:90) ) end end private def with_env(value) old_env = Rails.env Rails.env = value yield Rails.env = old_env end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ads-rails-0.2.0 | test/include_tag_test.rb |