diff options
Diffstat (limited to 'spec/experiments/application_experiment_spec.rb')
-rw-r--r-- | spec/experiments/application_experiment_spec.rb | 66 |
1 files changed, 0 insertions, 66 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 |