Sha256: d5be3d9aa05229aacd18e0cf20b500a36c37ddc5594e6934b0fe43598cb703fe
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'spec/spec_helper' describe CloudQuery::Schema do describe "#.to_xml" do before :each do @schema = CloudQuery::Schema.new('user.schema') @schema.fields << CloudQuery::Field.new(:name, :string) @schema.fields << CloudQuery::Field.new(:type, :literal) @schema.fields << CloudQuery::Field.new(:description, :text) @document = Nokogiri::XML(@schema.to_xml) end it "should output a schema element" do @document.at('schema').should_not be_nil end it "should output the schema name as an attribute" do @document.at('schema')['name'].should == 'user.schema' end it "should output the store attribute set to yes" do @document.at('schema')['store'].should == 'yes' end it "should output each of the fields as elements" do @schema.fields.each do |field| @document.at('schema').css('field').detect { |element| element['name'] == field.name.to_s }.should_not be_nil end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xoopit-cloud_query-0.2.0 | spec/lib/cloud_query/schema_spec.rb |
xoopit-cloud_query-0.2.1 | spec/lib/cloud_query/schema_spec.rb |