Sha256: 78c8d0281d99f2e021c99a838159d14e544a8f695472a094b461eb1333e47605

Contents?: true

Size: 893 Bytes

Versions: 63

Compression:

Stored size: 893 Bytes

Contents

shared_examples_for 'MetasploitDataModels::Search::Visitor::Includes#visit with #children' do
  let(:children) do
    2.times.collect { |n|
      double("Child #{n}")
    }
  end

  let(:node) do
    node_class.new(
        :children => children
    )
  end

  it 'should visit each child' do
    # needed for call to visit subject
    visitor.should_receive(:visit).with(node).and_call_original

    children.each do |child|
      visitor.should_receive(:visit).with(child).and_return([])
    end

    visit
  end

  it 'should return Array of all child visits' do
    child_visits = []

    visitor.should_receive(:visit).with(node).and_call_original

    children.each_with_index do |child, i|
      child_visit = ["Visited Child #{i}"]
      visitor.stub(:visit).with(child).and_return(child_visit)
      child_visits.concat(child_visit)
    end

    visit.should == child_visits
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
metasploit_data_models-0.20.0-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.8 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.8-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.7 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.7-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.4 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.4-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.3-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.3 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.0 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.19.0-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.18.1-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.18.1 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.18.0 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.18.0-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.18.0.pre.compatibility spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.17.3-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.17.3 spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.17.3.pre.metasploit.pre.concern-java spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb
metasploit_data_models-0.17.3.pre.metasploit.pre.concern spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb