test/unit/garb/report_test.rb in garb-0.7.4 vs test/unit/garb/report_test.rb in garb-0.7.5

- old
+ new

@@ -41,19 +41,27 @@ @report.stubs(:format_time).returns('2009-08-01') params = {'ids' => 'ga:1234', 'start-date' => '2009-08-01', 'end-date' => '2009-08-01'} assert_equal params, @report.default_params end + should "allow setting a segment id to the segment params" do + @report.set_segment_id 121 + assert_equal({'segment' => 'gaid::121'}, @report.segment_params) + end + should "collect params from metrics, dimensions, filters, sort, and defaults" do @report.stubs(:metrics).returns(stub(:to_params => {'metrics' => 6})) @report.stubs(:dimensions).returns(stub(:to_params => {'dimensions' => 5})) @report.stubs(:filters).returns(stub(:to_params => {'filters' => 4})) @report.stubs(:sort).returns(stub(:to_params => {'sort' => 3})) @report.stubs(:page_params).returns({'page_params' => 2}) @report.stubs(:default_params).returns({'default_params' => 1}) + @report.stubs(:segment_params).returns({'segment' => 'gaid::10'}) - params = {'metrics' => 6, 'dimensions' => 5, 'filters' => 4, 'sort' => 3, 'page_params' => 2, 'default_params' => 1} - assert_equal params, @report.params + expected_params = {'metrics' => 6,'dimensions' => 5, 'filters' => 4, 'sort' => 3, + 'page_params' => 2, 'default_params' => 1, 'segment' => 'gaid::10'} + + assert_equal expected_params, @report.params end should "format time" do assert_equal @now.strftime('%Y-%m-%d'), @report.format_time(@now) end \ No newline at end of file