Sha256: 5542485a5d6a81ae90862806d39fdffbcd962fae306974ef241ea2004c329b51
Contents?: true
Size: 1.38 KB
Versions: 6
Compression:
Stored size: 1.38 KB
Contents
require 'gooddata' describe GoodData::SmallGoodZilla do MAQL_EXAMPLE = 'SELECT SUM(#"Amount") WHERE @"Date"=#"X" AND ?"Snapshot EOP"=1' FACTS = { "Amount" => "a", "X" => "x" } ATTRIBUTES = { "Date" => "d" } METRICS = { "Snapshot EOP" => "snap" } DICT = { :facts => FACTS, :attributes => ATTRIBUTES, :metrics => METRICS, } it "should parse metrics out of the string" do x = GoodData::SmallGoodZilla.get_facts(MAQL_EXAMPLE) x.should == ["Amount", "X"] end it "should parse attributes out of the string" do x = GoodData::SmallGoodZilla.get_attributes(MAQL_EXAMPLE) x.should == ["Date"] end it "should parse metrics out of the string" do x = GoodData::SmallGoodZilla.get_metrics(MAQL_EXAMPLE) x.should == ["Snapshot EOP"] end it "should interpolate the values" do interpolated = GoodData::SmallGoodZilla.interpolate({ :facts => ["Amount", "X"], :attributes => ["Date"], :metrics => ["Snapshot EOP"] }, DICT) interpolated.should == { :facts => [["Amount", "a"], ["X", "x"]], :attributes => [["Date", "d"]], :metrics => [["Snapshot EOP", "snap"]] } end it "should return interpolated metric" do interpolated = GoodData::SmallGoodZilla.interpolate_metric(MAQL_EXAMPLE, DICT) interpolated.should == "SELECT SUM([a]) WHERE [d]=[x] AND [snap]=1" end end
Version data entries
6 entries across 6 versions & 1 rubygems