class Graphiti::ResourceTestGenerator
Public Instance Methods
generate()
click to toggle source
# File lib/generators/graphiti/resource_test_generator.rb, line 18 def generate generate_resource_specs end
Private Instance Methods
dir()
click to toggle source
# File lib/generators/graphiti/resource_test_generator.rb, line 28 def dir @resource.gsub("Resource", "").underscore.pluralize end
generate_resource_specs()
click to toggle source
# File lib/generators/graphiti/resource_test_generator.rb, line 32 def generate_resource_specs if actions?("create", "update", "destroy") to = "spec/resources/#{var}/writes_spec.rb" template("resource_writes_spec.rb.erb", to) end if actions?("index", "show") to = "spec/resources/#{var}/reads_spec.rb" template("resource_reads_spec.rb.erb", to) end end
model_class()
click to toggle source
# File lib/generators/graphiti/resource_test_generator.rb, line 52 def model_class resource_class.model end
resource_class()
click to toggle source
# File lib/generators/graphiti/resource_test_generator.rb, line 44 def resource_class @resource.constantize end
type()
click to toggle source
# File lib/generators/graphiti/resource_test_generator.rb, line 48 def type resource_class.type end
var()
click to toggle source
# File lib/generators/graphiti/resource_test_generator.rb, line 24 def var dir.singularize end