require 'spec_helper' # This example is taken from the Mondrian documentation: # http://mondrian.pentaho.com/documentation/schema.php#Cubes_and_dimensions # and then modified to use Rails/Rubiks conventions # # We want the output to be: # # # # # # # #
# # # # # # #
# # # # # # # # # # # # # # # describe 'A basic Mondrian XML Schema' do let(:described_class) { ::Rubiks::Schema } let(:schema_hash) { { 'cubes' => [{ 'name' => 'sales', 'measures' => [ { 'name' => 'unit_sales', 'aggregator' => 'sum', 'format_string' => '#,###' }, { 'name' => 'store_sales', 'aggregator' => 'sum', 'format_string' => '#,###.##' }, { 'name' => 'store_cost', 'aggregator' => 'sum', 'format_string' => '#,###.00' } ], 'dimensions' => [ { 'name' => 'date', 'hierarchies' => [{ 'name' => 'day_of_week', 'levels' => [{ 'name' => 'day_of_week' }] }] } ] }] } } # subject { described_class.new_from_hash(schema_hash) } # describe '#to_json' do # it 'generates a JSON string' do # subject.to_json.should be_kind_of String # end # it 'generates a valid JSON string' do # lambda { # MultiJson.load(subject.to_json) # }.should_not raise_error MultiJson::LoadError # end # end end