Sha256: ee201c00c2360e656cd9b884edf12eb1c0e89e72767dfedc22d8f426c1201c12

Contents?: true

Size: 1.2 KB

Versions: 11

Compression:

Stored size: 1.2 KB

Contents

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::Experiment.find_or_create('color', 'red', 'blue')
      Split::Metric.possible_experiments('color').should == [experiment]
    end

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

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

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

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

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
split-0.7.2 spec/metric_spec.rb
split-0.7.1 spec/metric_spec.rb
split-0.7.0 spec/metric_spec.rb
split-0.6.6 spec/metric_spec.rb
split-0.6.5 spec/metric_spec.rb
split-0.6.4 spec/metric_spec.rb
split-0.6.3 spec/metric_spec.rb
split-0.6.2 spec/metric_spec.rb
split-0.6.1 spec/metric_spec.rb
split-0.6.0 spec/metric_spec.rb
split-0.5.0 spec/metric_spec.rb