diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 76092d526..082c74754 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,7 +11,6 @@ class ApplicationController < ActionController::Base before_action :ensure_signup_complete around_action :switch_locale - before_action :track_email_campaign before_action :set_return_url check_authorization unless: :devise_controller? @@ -91,13 +90,6 @@ class ApplicationController < ActionController::Base end end - def track_email_campaign - if params[:track_id] - campaign = Campaign.find_by(track_id: params[:track_id]) - ahoy.track campaign.name if campaign.present? - end - end - def set_return_url if request.get? && !devise_controller? && is_navigational_format? store_location_for(:user, request.fullpath) diff --git a/app/models/campaign.rb b/app/models/campaign.rb deleted file mode 100644 index 69ab7c811..000000000 --- a/app/models/campaign.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Campaign < ApplicationRecord -end diff --git a/spec/factories/analytics.rb b/spec/factories/analytics.rb index bc7fa2654..0d564336e 100644 --- a/spec/factories/analytics.rb +++ b/spec/factories/analytics.rb @@ -9,9 +9,4 @@ FactoryBot.define do id { SecureRandom.uuid } started_at { DateTime.current } end - - factory :campaign do - sequence(:name) { |n| "Campaign #{n}" } - sequence(:track_id, &:to_s) - end end diff --git a/spec/system/admin/stats_spec.rb b/spec/system/admin/stats_spec.rb index 9ac12611c..86a7a8afa 100644 --- a/spec/system/admin/stats_spec.rb +++ b/spec/system/admin/stats_spec.rb @@ -152,19 +152,21 @@ describe "Stats", :admin do context "graphs" do scenario "event graphs", :with_frozen_time do - campaign = create(:campaign) + visit new_debate_path + fill_in_new_debate_title with: "A title for a debate" + fill_in_ckeditor "Initial debate text", with: "This is very important because..." + check "debate_terms_of_service" + click_button "Start a debate" - visit root_path(track_id: campaign.track_id) - - expect(page).to have_content "Sign out" + expect(page).to have_content "Debate created successfully." visit admin_stats_path within("#stats") do - click_link campaign.name + click_link "Debates" end - expect(page).to have_content "#{campaign.name} (1)" + expect(page).to have_content "Debates (1)" within("#graph") do expect(page).to have_content Date.current.strftime("%Y-%m-%d") diff --git a/spec/system/campaigns_spec.rb b/spec/system/campaigns_spec.rb deleted file mode 100644 index 7fe4b6afe..000000000 --- a/spec/system/campaigns_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -require "rails_helper" - -describe "Email campaigns", :admin do - let!(:campaign1) { create(:campaign) } - let!(:campaign2) { create(:campaign) } - - scenario "Track email templates" do - 3.times { visit root_path(track_id: campaign1.track_id) } - 5.times { visit root_path(track_id: campaign2.track_id) } - - visit admin_stats_path - click_link campaign1.name - - expect(page).to have_content "#{campaign1.name} (3)" - - click_link "Go back" - click_link campaign2.name - - expect(page).to have_content "#{campaign2.name} (5)" - end - - scenario "Do not track erroneous track_ids" do - invalid_id = Campaign.last.id + 1 - - visit root_path(track_id: campaign1.track_id) - visit root_path(track_id: invalid_id) - - visit admin_stats_path - - expect(page).to have_content campaign1.name - expect(page).not_to have_content campaign2.name - - click_link campaign1.name - - expect(page).to have_content "#{campaign1.name} (1)" - end -end