Sha256: 4cb647de074398ef022b5c99db665049e3bc340c36144e4dda848f1c2f4e1bf0
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require "spec_helper" class TestSmooch < Smooch::Base @@cookies = {} # override stuff provided by controller def get_cookie(key) @@cookies[key] end def set_cookie(key, name) @@cookies[key] = name end end describe TestSmooch do describe "#ab" do before(:each) do @km = TestSmooch.new @val = @km.ab("Signup Button Color", ["red", "green"]) end it "should return one of the variants" do (@val=="red" || @val=="green").should == true end it "should always be the same" do 30.times do @km.ab("Signup Button Color", ["red", "green"]).should == @val end end it "should persist across sessions" do 30.times do TestSmooch.new.ab("Signup Button Color", ["red", "green"]).should == @val end end it "should adjust when options change" do @val = @km.ab("Signup Button Color", ["blue", "brown", "orange"]) (@val=="blue" || @val=="brown" || @val=="orange").should == true @km.ab("Signup Button Color", ["blue", "brown", "orange"]).should == @val end it "should return previous value without choices" do @km.ab("Signup Button Color").should == @val TestSmooch.new.ab("Signup Button Color").should == @val end end describe "api key" do it "should return the api key from the config file" do km = TestSmooch.new km.api_key.should == "test_key_here" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
smooch-0.1.1 | spec/base_spec.rb |
smooch-0.1.0 | spec/base_spec.rb |