Sha256: 092aa2cbc168a1f62d8733fa3e9d3d38f114a32d5551f35274bdb959d4811dd4

Contents?: true

Size: 1.18 KB

Versions: 13

Compression:

Stored size: 1.18 KB

Contents

require '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 << :page_path)
        assert_equal [:page_path], @metrics.elements
      end
      
      should "merge an array of elements" do
        assert_equal(@metrics, @metrics << [:page_path])
        assert_equal [:page_path], @metrics.elements
      end

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

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

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
readmedia-garb-0.9.1.1 test/unit/garb/report_parameter_test.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/garb-0.9.1/test/unit/garb/report_parameter_test.rb
garb-0.9.1 test/unit/garb/report_parameter_test.rb
garb-0.9.0 test/unit/garb/report_parameter_test.rb
garb-0.8.5 test/unit/garb/report_parameter_test.rb
titanous-garb-0.8.7 test/unit/garb/report_parameter_test.rb
titanous-garb-0.8.5 test/unit/garb/report_parameter_test.rb
garb-0.8.4 test/unit/garb/report_parameter_test.rb
garb-0.8.3 test/unit/garb/report_parameter_test.rb
garb-0.8.2 test/unit/garb/report_parameter_test.rb
garb-0.8.1 test/unit/garb/report_parameter_test.rb
garb-0.8.0 test/unit/garb/report_parameter_test.rb
garb-0.7.6 test/unit/garb/report_parameter_test.rb