Sha256: 0f426d8d1d6dd98b2bb0592fe9a0099a4003d6a753529032ac479a6cd3a484f7

Contents?: true

Size: 1.21 KB

Versions: 13

Compression:

Stored size: 1.21 KB

Contents

require "#{File.dirname(__FILE__)}/../spec_helper"


describe 'Nested, Unit', :unit_test => true do

  let(:nodule) { CukeModeler::Nested }
  let(:nested_model) { Object.new.extend(nodule) }


  describe 'unique behavior' do

    describe 'an object including the module' do

      it 'has a parent model' do
        expect(nested_model).to respond_to(:parent_model)
      end

      it 'can change its parent model' do
        expect(nested_model).to respond_to(:parent_model=)

        nested_model.parent_model = :some_parent_model
        expect(nested_model.parent_model).to eq(:some_parent_model)
        nested_model.parent_model = :some_other_parent_model
        expect(nested_model.parent_model).to eq(:some_other_parent_model)
      end

      it 'has access to its ancestors' do
        expect(nested_model).to respond_to(:get_ancestor)
      end

      it 'gets an ancestor based on type' do
        expect(nodule.instance_method(:get_ancestor).arity).to eq(1)
      end

      it 'raises and exception if an unknown ancestor type is requested' do
        expect { nested_model.get_ancestor(:bad_ancestor_type) }.to raise_exception(ArgumentError)
      end

    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cuke_modeler-2.1.0 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-2.0.0 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.5.1 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.5.0 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.4.0 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.3.0 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.2.1 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.2.0 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.1.1 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.1.0 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.0.4 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.0.3 testing/rspec/spec/unit/nested_unit_spec.rb
cuke_modeler-1.0.2 testing/rspec/spec/unit/nested_unit_spec.rb