Sha256: 273a93ff0196cc8351a4dd05d41ae6c77faaf0ad5fb426304730ecf2c53e54f9

Contents?: true

Size: 730 Bytes

Versions: 7

Compression:

Stored size: 730 Bytes

Contents

require 'spec_helper'

describe ::Rubiks::Cube do
  subject { described_class.new }

  it_behaves_like 'a named object'

  its(:to_xml) { should be_equivalent_to(Nokogiri::XML(<<-XML)) }
    <cube name="Default">
      <table name="view_defaults"/>
    </cube>
  XML

  context 'with calculated measures' do
    subject {
      cube = described_class.new
      cube.calculated_measure :profit
      cube
    }

    its(:json_hash) { should_not have_key 'calculated_measures' }
    its(:json_hash) { should have_key 'measures' }

    it 'adds calculated measures to the measures array' do
      subject.json_hash['measures'].length.should eq 1
      subject.json_hash['measures'].first['name'].should eq 'Profit'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubiks-0.1.8 spec/rubiks/cube_spec.rb
rubiks-0.1.7 spec/rubiks/cube_spec.rb
rubiks-0.1.6 spec/rubiks/cube_spec.rb
rubiks-0.1.5 spec/rubiks/cube_spec.rb
rubiks-0.1.4 spec/rubiks/cube_spec.rb
rubiks-0.1.3 spec/rubiks/cube_spec.rb
rubiks-0.1.2 spec/rubiks/cube_spec.rb