test/test_helper.rb in xeroizer-0.1.3 vs test/test_helper.rb in xeroizer-0.2.0

- old
+ new

@@ -37,13 +37,21 @@ else get_file_as_string("records/#{type}-#{id}.xml") end end + def get_report_xml(report_type) + get_file_as_string("reports/#{report_type.underscore}.xml") + end + def mock_api(model_name) @client.stubs(:http_get).with {|client, url, params| url =~ /#{model_name}$/ }.returns(get_record_xml("#{model_name.underscore.pluralize}".to_sym)) @client.send("#{model_name.singularize}".to_sym).all.each do | record | @client.stubs(:http_get).with {|client, url, params| url =~ /#{model_name}\/#{record.id}$/ }.returns(get_record_xml("#{model_name.underscore.singularize}".to_sym, record.id)) end + end + + def mock_report_api(report_type) + @client.stubs(:http_get).with { | client, url, params | url =~ /Report\/#{report_type}$/ }.returns(get_report_xml(report_type)) end end \ No newline at end of file