require 'test_helper' class IncludeTagTest < ActionDispatch::IntegrationTest test "should show adsense code if env is production and there is no renderer" do assert ::Rails.application.config.ads.renderer.nil? with_env 'production' do get '/' assert_response :success assert response.body.include?("") assert response.body.include?('") assert response.body.include?('") end with_env 'development' do ::Rails.application.config.ads.renderer = proc { |options| content_tag :script, "") end end test "should show gray div if env is not production and there is no renderer" do assert ::Rails.application.config.ads.renderer.nil? with_env 'development' do get '/' assert_response :success assert response.body.include?('
') end end private def with_env(value) old_env = Rails.env Rails.env = value yield Rails.env = old_env end end