Sha256: 0e9cbae527b7fd42a6570ac92ff475edac2db6fd24e61fd026758a0871b88745

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require 'spec_helper'

describe ::Rubiks::Cube 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?(:dimensions) }
  specify { subject.respond_to?(:measures) }

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

    it { should be_valid }

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

    it 'has a Rubiks::Dimension' do
      subject.dimensions.first.should be_kind_of(::Rubiks::Dimension)
    end

    it 'has a Rubiks::Measure' do
      subject.measures.first.should be_kind_of(::Rubiks::Measure)
    end

    it 'has one value' do
      subject.values.size.should eq(1)
    end
  end

  context 'when parsed from an invalid (empty) hash' do
    subject { described_class.new_from_hash({}) }

    it { should_not be_valid }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubiks-0.0.4 spec/rubiks/nodes/cube_spec.rb