Sha256: c359aba16e34a6c3a1f0d35de31d99ec1b984162651d17122b37b0c01a1f7d34

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

require File.join(File.dirname(__FILE__), '..', '/test_helper')

class OperatorTest < MiniTest::Unit::TestCase
  context "An instance of an Operator" do
    should "lower camelize the target" do
      assert_equal "ga:uniqueVisits=", Operator.new(:unique_visits, "=").to_ga
    end
    
    should "return target and operator together" do
      assert_equal "ga:metric=", Operator.new(:metric, "=").to_ga
    end
    
    should "prefix the operator to the target" do
      assert_equal "-ga:metric", Operator.new(:metric, "-", true).to_ga
    end
    
    should "know if it is equal to another operator" do
      op1 = Operator.new(:hello, "==")
      op2 = Operator.new(:hello, "==")
      assert_equal op1, op2
    end
    
    should "not be equal to another operator if target, operator, or prefix is different" do
      op1 = Operator.new(:hello, "==")
      op2 = Operator.new(:hello, "==", true)
      refute_equal op1, op2
      
      op1 = Operator.new(:hello1, "==")
      op2 = Operator.new(:hello2, "==")
      refute_equal op1, op2
      
      op1 = Operator.new(:hello, "!=")
      op2 = Operator.new(:hello, "==")
      refute_equal op1, op2
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
garb-0.4.0 test/unit/operator_test.rb
garb-0.3.2 test/unit/operator_test.rb
garb-0.3.1 test/unit/operator_test.rb
garb-0.3.0 test/unit/operator_test.rb