Sha256: 1d422f42c1670dd1f30ccc3365d98decb4734939703b09c39c406b93f46b45a2
Contents?: true
Size: 1.28 KB
Versions: 75
Compression:
Stored size: 1.28 KB
Contents
module HelperMethods def set_fos_db(models) set_db(models,DB_FOS) end def set_demo_db(models) set_db(models,DB_DEMO) end def set_db(models,db) models.each{ |model| model.db=db } end # delete other rows, and create new one def add_test_table_data(hash) DB_DEMO[:test_table].delete DB_DEMO[:test_table] << hash end def get_fos_fixture(file_name) YAML.load_file(File.join(RAILS_ROOT,'spec','fos_fixtures',"#{file_name}.yml")) end def get_ipc_fixture(file_name) YAML.load_file(File.join(RAILS_ROOT,'spec','ipc_fixtures',"#{file_name}.yml")) end # controller helpers def should_render_json_for(obj,path) mock(obj).to_fos_json(is_a(Hash)) {"json"} call_controller path response.body.should == "json" end def should_render_xml_for(obj,path) request.env["HTTP_ACCEPT"] = "application/xml" mock(obj).to_fos_xml(is_a(Hash)) {"xml"} call_controller path response.body.should == "xml" end def equal_xml(other) simple_matcher("xml #{other} not equal") do |actual| actual.gsub(/\s/,'').should == other.gsub(/\s/,'') end end def stub_save_for_model(model) stub.instance_of(model)._refresh(anything) {} stub.instance_of(model)._update(anything) {} stub.instance_of(model)._insert {} end end
Version data entries
75 entries across 75 versions & 1 rubygems