summaryrefslogtreecommitdiff
path: root/spec/experiments
diff options
context:
space:
mode:
Diffstat (limited to 'spec/experiments')
-rw-r--r--spec/experiments/application_experiment_spec.rb66
-rw-r--r--spec/experiments/require_verification_for_namespace_creation_experiment_spec.rb28
-rw-r--r--spec/experiments/security_reports_mr_widget_prompt_experiment_spec.rb6
3 files changed, 0 insertions, 100 deletions
diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb
index b144e6f77d2..7aca5e492f4 100644
--- a/spec/experiments/application_experiment_spec.rb
+++ b/spec/experiments/application_experiment_spec.rb
@@ -43,72 +43,6 @@ RSpec.describe ApplicationExperiment, :experiment do
variant: 'control'
)
end
-
- describe '#publish_to_database' do
- using RSpec::Parameterized::TableSyntax
-
- let(:publish_to_database) { ActiveSupport::Deprecation.silence { application_experiment.publish_to_database } }
-
- shared_examples 'does not record to the database' do
- it 'does not create an experiment record' do
- expect { publish_to_database }.not_to change(Experiment, :count)
- end
-
- it 'does not create an experiment subject record' do
- expect { publish_to_database }.not_to change(ExperimentSubject, :count)
- end
- end
-
- context 'when there is a usable subject' do
- let(:context) { { context_key => context_value } }
-
- where(:context_key, :context_value, :object_type) do
- :namespace | build(:namespace, id: non_existing_record_id) | :namespace
- :group | build(:namespace, id: non_existing_record_id) | :namespace
- :project | build(:project, id: non_existing_record_id) | :project
- :user | build(:user, id: non_existing_record_id) | :user
- :actor | build(:user, id: non_existing_record_id) | :user
- end
-
- with_them do
- it 'creates an experiment and experiment subject record' do
- expect { publish_to_database }.to change(Experiment, :count).by(1)
-
- expect(Experiment.last.name).to eq('namespaced/stub')
- expect(ExperimentSubject.last.send(object_type)).to eq(context[context_key])
- end
- end
- end
-
- context "when experiment hasn't ran" do
- let(:context) { { user: create(:user) } }
-
- it 'sets a variant on the experiment subject' do
- publish_to_database
-
- expect(ExperimentSubject.last.variant).to eq('control')
- end
- end
-
- context 'when there is not a usable subject' do
- let(:context) { { context_key => context_value } }
-
- where(:context_key, :context_value) do
- :namespace | nil
- :foo | :bar
- end
-
- with_them do
- include_examples 'does not record to the database'
- end
- end
-
- context 'but we should not track' do
- let(:should_track) { false }
-
- include_examples 'does not record to the database'
- end
- end
end
describe "#track", :snowplow do
diff --git a/spec/experiments/require_verification_for_namespace_creation_experiment_spec.rb b/spec/experiments/require_verification_for_namespace_creation_experiment_spec.rb
index 269b6222020..c91a8f1950e 100644
--- a/spec/experiments/require_verification_for_namespace_creation_experiment_spec.rb
+++ b/spec/experiments/require_verification_for_namespace_creation_experiment_spec.rb
@@ -30,34 +30,6 @@ RSpec.describe RequireVerificationForNamespaceCreationExperiment, :experiment do
end
end
- describe '#record_conversion' do
- let_it_be(:namespace) { create(:namespace) }
-
- context 'when should_track? is false' do
- before do
- allow(experiment).to receive(:should_track?).and_return(false)
- end
-
- it 'does not record a conversion event' do
- expect(experiment.publish_to_database).to be_nil
- expect(experiment.record_conversion(namespace)).to be_nil
- end
- end
-
- context 'when should_track? is true' do
- before do
- allow(experiment).to receive(:should_track?).and_return(true)
- end
-
- it 'records a conversion event' do
- experiment_subject = experiment.publish_to_database
-
- expect { experiment.record_conversion(namespace) }.to change { experiment_subject.reload.converted_at }.from(nil)
- .and change { experiment_subject.context }.to include('namespace_id' => namespace.id)
- end
- end
- end
-
describe 'exclusions' do
context 'when user is new' do
it 'is not excluded' do
diff --git a/spec/experiments/security_reports_mr_widget_prompt_experiment_spec.rb b/spec/experiments/security_reports_mr_widget_prompt_experiment_spec.rb
index 4328ff12d42..ee02fa5f1f2 100644
--- a/spec/experiments/security_reports_mr_widget_prompt_experiment_spec.rb
+++ b/spec/experiments/security_reports_mr_widget_prompt_experiment_spec.rb
@@ -6,10 +6,4 @@ RSpec.describe SecurityReportsMrWidgetPromptExperiment do
it "defines a control and candidate" do
expect(subject.behaviors.keys).to match_array(%w[control candidate])
end
-
- it "publishes to the database" do
- expect(subject).to receive(:publish_to_database)
-
- subject.publish
- end
end