Sha256: 2e36e5e913c4dbe4ad95301677f689daf03eff53b2c01c727541e3f4d48a27eb
Contents?: true
Size: 1.38 KB
Versions: 11
Compression:
Stored size: 1.38 KB
Contents
require 'spec_helper' describe Legato::Filter do context "a Filter instance" do before :each do @filter = Legato::Filter.new(:exits, :lt, 1000, nil) end it 'has a field' do @filter.field.should == :exits end it 'has a google field' do Legato.stubs(:to_ga_string).returns("ga:exits") @filter.google_field.should == "ga:exits" Legato.should have_received(:to_ga_string) end it 'has an operator' do @filter.operator.should == :lt end it 'has a google operator' do @filter.google_operator.should == "<" end it 'has a value' do @filter.value.should == 1000 end it 'has a no default join character' do @filter.join_character.should == nil end it 'represents itself as a parameter' do @filter.to_param.should == "ga:exits<1000" end it 'joins with another filter' do filter2 = Legato::Filter.new(:pageviews, :gt, 1000, ',') filter2.join_with(@filter.to_param).should == "ga:exits<1000,ga:pageviews>1000" end it 'returns to_param if joining with nil' do @filter.join_with(nil).should == @filter.to_param end it 'properly escapes commas' do @filter.value = "," @filter.escaped_value.should == "\\," end it 'properly escapes semicolons' do @filter.value = ";" @filter.escaped_value.should == "\\;" end end end
Version data entries
11 entries across 11 versions & 1 rubygems