Sha256: 5dc050dab471f5aaa6d3d8038c35f941605ef9701cd678a15ac468647d33dd3d
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
require 'spec_helper' describe ::Rubiks::Measure do include_context 'schema_context' subject { described_class.new_from_hash } specify { subject.respond_to?(:from_hash) } specify { subject.respond_to?(:to_hash) } context 'when parsed from a valid hash' do subject { described_class.new_from_hash(measure_hash) } it { should be_valid } its(:to_hash) { should have_key('name') } its(:to_hash) { should have_key('aggregator') } its(:to_hash) { should have_key('format_string') } describe '#to_xml' do it 'renders a measure tag with attributes' do subject.to_xml.should be_like <<-XML <measure name="Fake Measure" aggregator="sum" formatString="#{subject.format_string}" column="fake_measure"/> XML end end end context 'when parsed with a specific column' do #subject { described_class.new_from_hash(measure_hash.merge('column' => 'foo')) } subject { described_class.new_from_hash('column' => 'foo') } describe '#to_xml' do it 'includes the specific column' do subject.to_xml.should be_like <<-XML <measure column="foo"/> XML end end end context 'when parsed from an invalid (empty) hash' do subject { described_class.new_from_hash({}) } it { should_not be_valid } describe '#to_xml' do it 'renders a measure tag' do subject.to_xml.should be_like <<-XML <measure/> XML end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubiks-0.0.6 | spec/rubiks/nodes/measure_spec.rb |
rubiks-0.0.5 | spec/rubiks/nodes/measure_spec.rb |