canvas-lms/spec/selenium/google_analytics_spec.rb

34 lines
1.2 KiB
Ruby

#
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
require File.expand_path(File.dirname(__FILE__) + '/common')
describe "google analytics" do
include_context "in-process server selenium tests"
it "should not include tracking script if not asked to" do
get "/"
expect(f("#content")).not_to contain_jqcss('script[src$="google-analytics.com/ga.js"]')
end
it "should include tracking script if google_analytics_key is configured" do
Setting.set('google_analytics_key', 'testing123')
get "/"
expect(fj('script[src$="google-analytics.com/ga.js"]')).not_to be_nil
end
end