spec/eeny-meeny/models/experiment_spec.rb in eeny-meeny-2.1.4 vs spec/eeny-meeny/models/experiment_spec.rb in eeny-meeny-2.2.0

- old
+ new

@@ -192,6 +192,19 @@ expect(described_class.find_by_id(:experiment_missing)).to be_nil end end end + 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 a configured experiment' do + it 'returns nil' do + expect(described_class.find_by_cookie_name(:eeny_meeny_undefined_experiment_v2)).to be_nil + end + end + end end