require 'spec_helper' # This example is taken from the Mondrian documentation: # http://mondrian.pentaho.com/documentation/schema.php#Cubes_and_dimensions # then modified to use Rails/Rubiks conventions # # We want the output to be: # # # # # # # #
# # # # # # # # # # # # # describe 'A Mondrian XML Schema' do let(:described_class) { ::Rubiks::Schema } let(:schema_hash) { { 'cubes' => [{ 'name' => 'sales', 'measures' => [ { 'name' => 'unit_sales', 'aggregator' => 'sum', 'format_string' => '#,###' } ], 'dimensions' => [ { 'name' => 'date', 'hierarchies' => [{ 'name' => 'year_quarter_month', 'levels' => [ { 'name' => 'year', 'type' => 'numeric' }, { 'name' => 'quarter', 'type' => 'string' }, { 'name' => 'month', 'type' => 'numeric' } ] }] } ], 'calculated_members' => [ { 'name' => 'Profit', 'dimension' => 'Measures', 'formula' => '[Measures].[Store Sales] - [Measures].[Store Cost]', 'format_string' => '$#,##0.00' } ] }] } } subject { described_class.new_from_hash(schema_hash) } describe '#to_xml' do it 'renders XML' do subject.to_xml.should be_like <<-XML
XML end end end