Sha256: d489e54274b592bab8a16d6cc9773440b485dc49fa060c7e07bcf83aa58f157e

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

shared_examples_for 'a nested element' do |clazz|

  before(:each) do
    @nested_element = clazz.new
  end

  it 'has a parent element - #parent_element' do
    @nested_element.should respond_to(:parent_element)
  end

  it 'can get and set its parent element - #parent_element, #parent_element=' do
    @nested_element.parent_element = :some_parent_element
    @nested_element.parent_element.should == :some_parent_element
    @nested_element.parent_element = :some_other_parent_element
    @nested_element.parent_element.should == :some_other_parent_element
  end

  it 'starts with no parent element' do
    @nested_element.parent_element.should == nil
  end

  it 'has access to its ancestors' do
    @nested_element.should respond_to(:get_ancestor)
  end

  it 'gets an ancestor based on type' do
    (clazz.instance_method(:get_ancestor).arity == 1).should be_true
  end

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

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
cuke_modeler-0.2.0 spec/unit/nested_element_unit_specs.rb
cuke_modeler-0.1.0 spec/unit/nested_element_unit_specs.rb
cuke_modeler-0.0.2 spec/unit/nested_element_unit_specs.rb
cuke_modeler-0.0.1 spec/unit/nested_element_unit_specs.rb
cucumber_analytics-1.5.1 spec/unit/nested_element_unit_specs.rb
cucumber_analytics-1.5.0 spec/unit/nested_element_unit_specs.rb
cucumber_analytics-1.4.2 spec/unit/nested_element_unit_specs.rb
cucumber_analytics-1.4.1 spec/unit/nested_element_unit_specs.rb
cucumber_analytics-1.4.0 spec/unit/nested_element_unit_specs.rb
cucumber_analytics-1.3.0 spec/unit/nested_element_unit_specs.rb