class Graphiti::ApiTestGenerator
Public Instance Methods
generate()
click to toggle source
# File lib/generators/graphiti/api_test_generator.rb, line 23 def generate generate_api_specs end
Private Instance Methods
dir()
click to toggle source
# File lib/generators/graphiti/api_test_generator.rb, line 33 def dir @resource.gsub("Resource", "").underscore.pluralize end
generate_api_specs()
click to toggle source
# File lib/generators/graphiti/api_test_generator.rb, line 37 def generate_api_specs if actions?("index") to = File.join("spec", ApplicationResource.endpoint_namespace, dir, "index_spec.rb") template("index_request_spec.rb.erb", to) end if actions?("show") to = File.join("spec", ApplicationResource.endpoint_namespace, dir, "show_spec.rb") template("show_request_spec.rb.erb", to) end if actions?("create") to = File.join("spec", ApplicationResource.endpoint_namespace, dir, "create_spec.rb") template("create_request_spec.rb.erb", to) end if actions?("update") to = File.join("spec", ApplicationResource.endpoint_namespace, dir, "update_spec.rb") template("update_request_spec.rb.erb", to) end if actions?("destroy") to = File.join("spec", ApplicationResource.endpoint_namespace, dir, "destroy_spec.rb") template("destroy_request_spec.rb.erb", to) end end
model_class()
click to toggle source
# File lib/generators/graphiti/api_test_generator.rb, line 72 def model_class resource_class.model end
resource_class()
click to toggle source
# File lib/generators/graphiti/api_test_generator.rb, line 64 def resource_class @resource.constantize end
type()
click to toggle source
# File lib/generators/graphiti/api_test_generator.rb, line 68 def type resource_class.type end
var()
click to toggle source
# File lib/generators/graphiti/api_test_generator.rb, line 29 def var dir.singularize end