spec/eeny-meeny/models/experiment_spec.rb in eeny-meeny-2.2.2 vs spec/eeny-meeny/models/experiment_spec.rb in eeny-meeny-2.3.0

- old
+ new

@@ -1,6 +1,5 @@ -require 'spec_helper' require 'eeny-meeny/models/experiment' require 'eeny-meeny/models/variation' def experiment_with_time(time = {}) experiment_options = { @@ -156,11 +155,11 @@ describe '.find_all' do context 'when the EenyMeeny is configured with experiments', experiments: true do it 'returns those experiments' do instances = described_class.find_all expect(instances).to be_a Array - expect(instances.size).to eq(2) + expect(instances.size).to eq(3) instances.each do |instance| expect(instance).to be_a EenyMeeny::Experiment end end end @@ -208,9 +207,15 @@ describe '.find_by_cookie_name', experiments: true do context 'when the given cookie name matches a configured experiment' do it 'returns the experiment' do expect(described_class.find_by_cookie_name(:eeny_meeny_my_page_v1)).to be_a EenyMeeny::Experiment + end + end + + context 'when the given cookie name does not match the experiment version' do + it 'returns the experiment' do + expect(described_class.find_by_cookie_name(:eeny_meeny_versioned_v2)).to be_nil end end context 'when the given cookie name does not match a configured experiment' do it 'returns nil' do