lib/fwtoolkit/test/model_helper.rb in fwtoolkit-0.5.0 vs lib/fwtoolkit/test/model_helper.rb in fwtoolkit-0.5.1
- old
+ new
@@ -44,28 +44,34 @@
raise "File defined in APP_BUNDLE_PATH (#{APP_BUNDLE_PATH}) does not exist" unless File.exists?(APP_BUNDLE_PATH)
APP_BUNDLE_PATH
end
def fwt_seed_app(model_names=[])
+ puts "Deprecated: fwt_seed_app(). Please use fwt_seed_app_with_pickle_models(). Will be changed in 0.6.0 to accept objects."
+ fwt_seed_app_with_pickle_models(model_names)
+ end
+
+ def fwt_seed_app_with_pickle_models(model_names=[])
objects = model_names.collect{|n| model!(n)}
- fwt_app_exec("seedCoreData:", objects.to_json)
+ fwt_seed_app_with_objects(objects)
end
+ def fwt_seed_app_with_objects(objects = [])
+ fwt_app_exec("seedCoreData:", objects.to_json)
+ end
+
def fwt_set_user_defaults(bundle_identifier, user_defaults)
-
app_dir = Dir.entries(fwt_simulator_applications_dir)
app_dir.delete "."
app_dir.delete ".."
plist_file = File.join(fwt_simulator_applications_dir, app_dir.first, 'Library', 'Preferences', "#{bundle_identifier}.plist")
plist = CFPropertyList::List.new(:file => plist_file)
data = CFPropertyList.native_types(plist.value)
data.merge! user_defaults
plist.value = CFPropertyList.guess(data)
plist.save(plist_file, CFPropertyList::List::FORMAT_BINARY)
-
end
-
end
end
end
World(FWToolkit::Test::ModelHelpers)
\ No newline at end of file