Sha256: d5811ede5178bbe33e6d7949ae9e761e588aafcac40c145c147f546bf86380c0
Contents?: true
Size: 987 Bytes
Versions: 1
Compression:
Stored size: 987 Bytes
Contents
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'caren-api' require 'rspec' require 'fakeweb' require 'capybara' Caren::Api.shared_key = "specs" Caren::Api.url = "http://example.com" FakeWeb.allow_net_connect = false RSpec::Matchers.define :convert_to_valid_caren_xml do match do |instance| hash = Hash.from_xml(instance.to_xml) keys = instance.as_xml.keys.map(&:to_s) (hash[instance.class.node_root.to_s].keys - keys).should be_empty keys.map{ |key| hash[instance.class.node_root.to_s][key].to_s == instance.send(key.to_sym).to_s }.inject(&:&) end end RSpec::Matchers.define :convert_to_valid_caren_array_xml do match do |array| hash = Hash.from_xml( array.first.class.to_xml(array) ) hash.keys.should eql [array.first.class.array_root.to_s] array.each do |obj| obj.should convert_to_valid_caren_xml end end end RSpec.configure do |config| end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caren-api-0.1.0 | spec/spec_helper.rb |