Sha256: c0534e84d13d4da3bab1d46a99c629e682f240814500633ce5fa32ebecffa669

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

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

module Garb
  class ReportParameterTest < MiniTest::Unit::TestCase
    
    context "An instance of the ReportParameter class" do
      setup do
        @metrics = ReportParameter.new(:metrics)
      end
      
      should "have a name" do
        assert_equal "metrics", @metrics.name
      end
      
      should "have a list of elements" do
        assert_equal [], @metrics.elements
      end
      
      should "be able to add new elements" do
        assert_equal(@metrics, @metrics << :request_uri)
        assert_equal [:request_uri], @metrics.elements
      end
      
      should "merge an array of elements" do
        assert_equal(@metrics, @metrics << [:request_uri])
        assert_equal [:request_uri], @metrics.elements
      end

      context "converting to params" do
        should "be able to format the parameters into strings" do
          @metrics << :request_uri
          assert_equal({'metrics' => 'ga:requestUri'}, @metrics.to_params)
        end

        should "join multiple symbol elements" do
          @metrics << :request_uri << :city
          assert_equal({'metrics' => 'ga:requestUri,ga:city'}, @metrics.to_params)
        end
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
garb-0.5.0 test/unit/garb/report_parameter_test.rb