Sha256: e4d4a30752aacf0a7bfaee6aa99eb3906ef2cd74cdd1f4ce8f11d8e7826e8898

Contents?: true

Size: 1.27 KB

Versions: 27

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true
require 'spec_helper'
require 'split/metric'

describe Split::Metric do
  describe 'possible experiments' do
    it "should load the experiment if there is one, but no metric" do
      experiment = Split::ExperimentCatalog.find_or_create('color', 'red', 'blue')
      expect(Split::Metric.possible_experiments('color')).to eq([experiment])
    end

    it "should load the experiments in a metric" do
      experiment1 = Split::ExperimentCatalog.find_or_create('color', 'red', 'blue')
      experiment2 = Split::ExperimentCatalog.find_or_create('size', 'big', 'small')

      metric = Split::Metric.new(:name => 'purchase', :experiments => [experiment1, experiment2])
      metric.save
      expect(Split::Metric.possible_experiments('purchase')).to include(experiment1, experiment2)
    end

    it "should load both the metric experiments and an experiment with the same name" do
      experiment1 = Split::ExperimentCatalog.find_or_create('purchase', 'red', 'blue')
      experiment2 = Split::ExperimentCatalog.find_or_create('size', 'big', 'small')

      metric = Split::Metric.new(:name => 'purchase', :experiments => [experiment2])
      metric.save
      expect(Split::Metric.possible_experiments('purchase')).to include(experiment1, experiment2)
    end
  end

end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
split-4.0.1 spec/metric_spec.rb
split-4.0.0.pre2 spec/metric_spec.rb
split-4.0.0.pre spec/metric_spec.rb
ab-split-1.0.2 spec/metric_spec.rb
ab-split-1.0.1 spec/metric_spec.rb
ab-split-1.0.0 spec/metric_spec.rb
split-3.4.1 spec/metric_spec.rb
split-3.4.0 spec/metric_spec.rb
split-3.3.2 spec/metric_spec.rb
split-3.3.1 spec/metric_spec.rb
split-3.3.0 spec/metric_spec.rb
split-3.2.0 spec/metric_spec.rb
split-3.1.1 spec/metric_spec.rb
split-3.1.0 spec/metric_spec.rb
split-3.0.0 spec/metric_spec.rb
split-2.2.0 spec/metric_spec.rb
split-2.1.0 spec/metric_spec.rb
split-2.0.0 spec/metric_spec.rb
split-1.7.0 spec/metric_spec.rb
split-1.6.0 spec/metric_spec.rb