require 'spec_helper'
def simple_structure_document
Nokogiri::XML(simple_structure_xml) do |config|
config.noblanks
end
end
def nested_structure_document
Nokogiri::XML(nested_structure_xml) do |config|
config.noblanks
end
end
def nested_structure_mptr_document
Nokogiri::XML(nested_structure_mptr_xml) do |config|
config.noblanks
end
end
def multiple_struct_maps_structure_document
Nokogiri::XML(multiple_struct_maps_structure) do |config|
config.noblanks
end
end
def simple_structure_xml
<<-eos
#{Ddr::Models::Structures::Agent::NAME_REPOSITORY_DEFAULT}
eos
end
def nested_structure_xml
<<-eos
Sam Spade
eos
end
def nested_structure_mptr_xml
<<-eos
Sam Spade
eos
end
def multiple_struct_maps_structure
<<-eos
eos
end
def simple_structure_dereferenced_hash
yaml = <<-eos
default:
:type: 'default'
:contents:
- :order: '1'
:contents:
- :repo_id: 'test:7'
:use: 'foo'
- :order: '2'
:contents:
- :repo_id: 'test:8'
:use: 'bar'
- :order: '3'
:contents:
- :repo_id: 'test:9'
:use: 'baz'
eos
YAML.load(yaml)
end
def nested_structure_dereferenced_hash
yaml = <<-eos
default:
:type: 'default'
:contents:
- :label: 'Front'
:order: '1'
:contents:
- :repo_id: 'test:7'
:use: 'foo'
- :label: 'Back'
:order: '2'
:contents:
- :label: 'Top'
:order: '1'
:contents:
- :repo_id: 'test:8'
:use: 'bar'
- :label: 'Bottom'
:order: '2'
:contents:
- :repo_id: 'test:9'
:use: 'baz'
eos
YAML.load(yaml)
end
def nested_structure_mptr_dereferenced_hash
yaml = <<-eos
default:
:type: 'default'
:contents:
- :label: 'Front'
:order: '1'
:contents:
- :repo_id: 'test:7'
- :label: 'Back'
:order: '2'
:contents:
- :label: 'Top'
:order: '1'
:contents:
- :repo_id: 'test:8'
- :label: 'Bottom'
:order: '2'
:contents:
- :repo_id: 'test:9'
eos
YAML.load(yaml)
end
def multiple_struct_maps_structure_dereferenced_hash
yaml = <<-eos
default:
:type: 'default'
:contents:
- :label: 'Front'
:order: '1'
:contents:
- :repo_id: 'test:7'
:use: 'foo'
- :label: 'Back'
:order: '2'
:contents:
- :label: 'Top'
:order: '1'
:contents:
- :repo_id: 'test:8'
:use: 'bar'
- :label: 'Bottom'
:order: '2'
:contents:
- :repo_id: 'test:9'
:use: 'baz'
reverse:
:type: 'reverse'
:contents:
- :label: 'Back'
:order: '1'
:contents:
- :label: 'Bottom'
:order: '1'
:contents:
- :repo_id: 'test:9'
:use: 'baz'
- :label: 'Top'
:order: '2'
:contents:
- :repo_id: 'test:8'
:use: 'bar'
- :label: 'Front'
:order: '2'
:contents:
- :repo_id: 'test:7'
:use: 'foo'
eos
YAML.load(yaml)
end
def simple_structure_to_json
simple_structure_dereferenced_hash.to_json
end
def nested_structure_to_json
nested_structure_dereferenced_hash.to_json
end
def nested_structure_mptr_to_json
nested_structure_mptr_dereferenced_hash.to_json
end
def multiple_struct_maps_structure_to_json
multiple_struct_maps_structure_dereferenced_hash.to_json
end