Sha256: da1803dde6bc7e08d695dc800cd1882d411499672da2088fe5122b601906d753
Contents?: true
Size: 1.29 KB
Versions: 14
Compression:
Stored size: 1.29 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
14 entries across 14 versions & 1 rubygems