Sha256: ab02fe90b6e70c2101f4752f134c4dd991af249e9d23fc7262411eb310b7fab8
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
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' # For the tests we need to know both the public and private key, so we share them here. Caren::Api.caren_public_key_path = "certs/example.pub" Caren::Api.private_key_path = "certs/example" 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
caren-api-0.3.3 | spec/spec_helper.rb |
caren-api-0.3.2 | spec/spec_helper.rb |
caren-api-0.3.1 | spec/spec_helper.rb |
caren-api-0.3.0 | spec/spec_helper.rb |
caren-api-0.2.0 | spec/spec_helper.rb |