Sha256: 2dee9b14e4f62d8efa7711203e0dd3a5a2b2cafa75f1f60cb2506d377c684602

Contents?: true

Size: 1008 Bytes

Versions: 2

Compression:

Stored size: 1008 Bytes

Contents

require 'spec_helper'

describe ::Rubiks::Dimension do
  include_context 'schema_context'

  subject { described_class.new_from_hash }

  specify { subject.respond_to?(:from_hash) }
  specify { subject.respond_to?(:to_hash) }
  specify { subject.respond_to?(:hierarchies) }

  context 'when parsed from a valid hash' do
    subject { described_class.new_from_hash(dimension_hash) }

    its(:to_hash) { should have_key('hierarchies') }

    it { should be_valid }

    describe '#to_xml' do
      it 'renders a dimension tag with attributes' do
        subject.to_xml.should include(%Q!<dimension name="Fake Dimension" foreignKey="fake_dimension_id">!)
      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 dimension tag' do
        subject.to_xml.should be_like <<-XML
        <dimension>
        </dimension>
        XML
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubiks-0.0.6 spec/rubiks/nodes/dimension_spec.rb
rubiks-0.0.5 spec/rubiks/nodes/dimension_spec.rb