  describe "<%= @resource.to_s %>" do
    let(:route) { "<%= @resource.to_s %>" }
    <%- @resource.http_methods.each do |method| %>
    describe "<%= method.method.upcase %>" do
      <% if method.headers %>let(:headers) do <% headers = method.headers.pretty.split("\n") %>
        <%= headers.join("\n        ") %>
      end<% end %>
      <% if method.request_body %>let(:request_body) do<% body = method.request_body.example.split("\n") %>
        <%= body.join("\n        ").gsub(/\:/, " =>") %>.to_json
      end
      <% end %>
      let(:response_body) do<% body = method.responses.first.bodies.first.example.split("\n") %>
        <%= body.join("\n        ").gsub(/\:/, " =>") %>.to_json
      end

      it "<%= method.description && method.description.downcase || "#{method.method}s the resource" %>" do
        <%= method.method %> route<% if method.request_body %>, request_body<% end %><% if method.headers %>, headers<% end %>
        expect(response.body).to eql response_body
      end

      it "returns status <%= method.responses.first.status_code %>" do
        <%= method.method %> route<% if method.request_body %>, request_body<% end %>
        expect(response.status).to eql <%= method.responses.first.status_code %>
      end
    end<%- end %>
  end

  describe "<%= @resource.to_s %>" do
    let(:route) { "<%= @resource.to_s %>" }
    <%- @resource.http_methods.each do |method| %>
    describe "<%= method.method.upcase %>" do
      <% if method.headers %>let(:headers) do <% headers = method.headers.pretty.split("\n") %>
        <%= headers.join("\n        ") %>

      end<% end %>
      <% if method.request_body %>let(:request_body) do<% body = method.request_body.example.split("\n") %>
        <%= body.join("\n        ").gsub(/\:/, " =>") %>.to_json
      end
      <% end %>
      let(:response_body) do<% body = method.responses.first.bodies.first.example.split("\n") %>
        <%= body.join("\n        ").gsub(/\:/, " =>") %>.to_json
      end

      it "<%= method.description && method.description.downcase || "#{method.method}s the resource" %>" do
        <%= method.method %> route<% if method.request_body %>, request_body<% end %><% if method.headers %>, headers<% end %>
        expect(response.body).to eql response_body
      end

      it "returns status <%= method.responses.first.status_code %>" do
        <%= method.method %> route<% if method.request_body %>, request_body<% end %><% if method.headers %>, headers<% end %>
        expect(response.status).to eql <%= method.responses.first.status_code %>
      end
    end<%- end %>
  end

Make sure request headers included on all requests
Make sure request headers included on all requests
