Sha256: 9e33ec1d869478db902017b3249d46938c9074c57e297fc273f2e4ca0edfdad7
Contents?: true
Size: 793 Bytes
Versions: 1
Compression:
Stored size: 793 Bytes
Contents
module ElementTestMacros def xml(part) File.read(File.join(File.dirname(__FILE__), "data", "elements", "#{part}_element.xml")).strip end def self.included(base) attr_reader :node base.extend ClassMethods end module ClassMethods def it_should_output_correct_xml(node_xml: nil) it "should be able to output the correct XML" do if node_xml.nil? node_xml = described_class.to_s.split(/::/).last node_xml = node_xml.gsub(/(.)([A-Z])/, '\1_\2').downcase end generated_xml = Nokogiri::XML::Builder.new do |xml| xml.root("xmlns:w" => "http://wnamespace.org") { node.to_xml(xml) } end.to_xml expect(generated_xml).to eq(xml(node_xml) + "\n") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rocx-0.5.8 | spec/support/element_test_macros.rb |