lib/generators/hoc_utils/api_scaffold/api_scaffold_generator.rb
# Generates spec stubs for swagger.
Generates spec stubs for swagger.
Generates spec stubs for swagger .
def generate_specs
        say "Generates spec/integration/#{plural_table_name}_spec.rb", :bold
        template "spec.rb.tt", "spec/integration/#{plural_table_name}_spec.rb"
        say "Adds definitions to spec/swagger_helper.rb", :bold
        insert_into_file "spec/swagger_helper.rb", :after => "definitions: {\n" do
          %{
          # AUTO GENERATED STUB TODO: update with correct fields
          #{singular_table_name}_input: {
            description: 'TODO: replace with correct description',
            type: 'object',
            properties: {
            },
            required: [] #TODO require
          },
          # AUTO GENERATED STUB TODO: update with correct fields
          #{singular_table_name}: {
            description: 'TODO: replace with correct description',
            type: 'object',
            properties: {
              id: { type: "integer"},
              created_at: { type: "string"},
              updated_at: { type: "string"},
            }
          },
          # AUTO GENERATED STUB TODO: update with correct fields
          #{plural_table_name}: {
            type: 'object',
            properties: {
              meta: { "$ref": "#/definitions/meta" },
              #{plural_table_name}: { type: 'array', items: { "$ref": "#/definitions/#{singular_table_name}" },},
            }
          },
        }
        end
      end
def generate_specs say "Generates spec/integration/#{plural_table_name}_spec.rb" , :bold template "spec.rb.tt" , "spec/integration/#{plural_table_name}_spec.rb" say "Adds definitions to spec/swagger_helper.rb" , :bold insert_into_file "spec/swagger_helper.rb" , :after => "definitions: {\n" do %{
          # AUTO GENERATED STUB TODO: update with correct fields
          #{singular_table_name}_input: {
            description: 'TODO: replace with correct description',
            type: 'object',
            properties: {

            },
            required: [] #TODO require
          },
          # AUTO GENERATED STUB TODO: update with correct fields
          #{singular_table_name}: {
            description: 'TODO: replace with correct description',
            type: 'object',
            properties: {
              id: { type: "integer"},
              created_at: { type: "string"},
              updated_at: { type: "string"},
            }
          },
          # AUTO GENERATED STUB TODO: update with correct fields
          #{plural_table_name}: {
            type: 'object',
            properties: {
              meta: { "$ref": "#/definitions/meta" },
              #{plural_table_name}: { type: 'array', items: { "$ref": "#/definitions/#{singular_table_name}" },},
            }
          },
        } end end
Generates spec stubs for swagger.
Generates spec stubs for swagger .