spec/lib/gxapi/base_spec.rb in gxapi_rails-0.0.4 vs spec/lib/gxapi/base_spec.rb in gxapi_rails-0.0.5

- old
+ new

@@ -17,19 +17,23 @@ let(:test_experiment_name) do "Untitled experiment" end + let(:test_experiment_id) do + "lj5s_ZvWSJSZLphnkpP-Xw" + end + context "#env" do it "should delegate to its class" do subject.env.should eql Gxapi.env end end context "#get_variant" do - it "should make a call to myna and return a future" do + it "should make a call to Google Analytics and return a future" do variant = subject.get_variant(test_experiment_name) valid_variants.should include variant.value.name [0, 1].should include variant.value.index end @@ -39,9 +43,16 @@ variant = subject.get_variant(test_experiment_name) variant.value cache_key = "#{user_key}_untitled_experiment" Gxapi.cache.read(cache_key).should have_key("index") + + end + + it "lets us search by experiment id" do + + variant = subject.get_variant(id: test_experiment_id) + expect(variant.value.experiment_id).to eql(test_experiment_id) end it "should time out after 2 seconds and return the default value" do \ No newline at end of file