<commit_before>require File.dirname(__FILE__) + "/spec_helper"
require File.join(File.dirname(__FILE__), '../lib/RestShifter/Shifter.rb')

describe RestShifter do

  def app
    Sinatra::Application
  end

  # Get
  it "Service should return 200 for get" do
    get '/ok'
    expect(last_response.status).to eq(200)
    expect(last_response.body).to eq("success")
    expect(last_response.headers['Content-Type']).to eq("application/json")
  end

  it "Service should return 404 without accept defining routing for get" do
    get '/notfound'
    expect(last_response.status).to eq(404)
    expect(last_response.body).to eq("Not Found")
    expect(last_response.headers['Content-Type']).to eq("application/foo.company.product.type-version+json")
  end

  # Post
  it "Service should return 200 for post" do
    post '/ok'
    expect(last_response.status).to eq(200)
    expect(last_response.body).to eq("success")
    expect(last_response.headers['Content-Type']).to eq("application/json")
  end

  it "Service should return 404 without accept defining routing for post" do
    post '/notfound'
    expect(last_response.status).to eq(404)
    expect(last_response.body).to eq("Not Found")
    expect(last_response.headers['Content-Type']).to eq("application/foo.company.product.type-version+json")
  end

#  it "Service should return 404 with accept defining routing" do
#    header 'Accept', "application/foo.company.product.type-version2+json"
#    get '/notfound'
#    expect(last_response.status).to eq(404)
#    expect(last_response.body).to eq("Not Found with accept")
#    expect(last_response.headers['Content-Type']).to eq("application/foo.company.product.type-version2+json")
#  end

end
<commit_msg>Improving structure of the tests<commit_after>require File.dirname(__FILE__) + "/spec_helper"
require File.join(File.dirname(__FILE__), '../lib/RestShifter/Shifter.rb')

describe RestShifter do

  def app
    Sinatra::Application
  end

  describe "Get Operations" do
    # Get
    it "Service should return 200 for get" do
      get '/ok'
      expect(last_response.status).to eq(200)
      expect(last_response.body).to eq("success")
      expect(last_response.headers['Content-Type']).to eq("application/json")
    end

    it "Service should return 404 without accept defining routing for get" do
      get '/notfound'
      expect(last_response.status).to eq(404)
      expect(last_response.body).to eq("Not Found")
      expect(last_response.headers['Content-Type']).to eq("application/foo.company.product.type-version+json")
    end

    #  it "Service should return 404 with accept defining routing" do
    #    header 'Accept', "application/foo.company.product.type-version2+json"
    #    get '/notfound'
    #    expect(last_response.status).to eq(404)
    #    expect(last_response.body).to eq("Not Found with accept")
    #    expect(last_response.headers['Content-Type']).to eq("application/foo.company.product.type-version2+json")
    #  end
  end
  describe "Post operations" do

    # Post
    it "Service should return 200 for post" do
      post '/ok'
      expect(last_response.status).to eq(200)
      expect(last_response.body).to eq("success")
      expect(last_response.headers['Content-Type']).to eq("application/json")
    end

    it "Service should return 404 without accept defining routing for post" do
      post '/notfound'
      expect(last_response.status).to eq(404)
      expect(last_response.body).to eq("Not Found")
      expect(last_response.headers['Content-Type']).to eq("application/foo.company.product.type-version+json")
    end

  end
end

{'fraction_non_alphanumeric': 0.12743461324429606, 'fraction_numerical': 0.017807456872565387, 'mean_word_length': 3.8646820027063598, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3701728', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1076, 'n_words': 252}