<commit_before>require 'spec_helper'

describe "/api/v1/depots" do
  let(:url) { "/api/v1" }
  let(:another_user) { create(:user, name: "Another User") }

  before do
    @depot1 = create(:depot, name: "depot 1").reload
    @depot2 = create(:depot, name: "depot 2").reload
  end

  def expected_index_response_for(depot)
    { "id" => depot.id,
      "name" => depot.name,
      "address" => depot.address,
      "city" => depot.city,
      "latitude" => depot.latitude.to_s,
      "longitude" => depot.longitude.to_s,
      "accepts_new_members" => depot.accepts_new_members,
      "is_established" => depot.is_established,
      "description" => depot.description,
      "contact_name" => depot.contact_name,
      "contact_phone" => depot.contact_phone,
      "updated_at" => depot.updated_at.to_json.gsub("\"", ''),
      "type" => depot.type,
      "user_id" => depot.user_id }
  end

  def expected_show_response_for(depot)
    expected_index_response_for(depot).merge(
      { "places" => depot.places }
    )
  end

  shared_examples_for "a readable depot" do
    it "returns a depot" do
      get "#{url}/depots/#{@depot1.id}", auth_token: token

      expect(last_response.status).to eq(200)
      response = JSON.parse(last_response.body)
      expect(response).to eq(expected_show_response_for(@depot1))
    end
<commit_msg>Fix depot specs broken in commit <PASSWORD>.<commit_after>require 'spec_helper'

describe "/api/v1/depots" do
  let(:url) { "/api/v1" }
  let(:another_user) { create(:user, name: "Another User") }

  before do
    @depot1 = create(:depot, name: "depot 1").reload
    @depot2 = create(:depot, name: "depot 2").reload
  end

  def expected_index_response_for(depot)
    { "id" => depot.id,
      "name" => depot.name,
      "address" => depot.address,
      "city" => depot.city,
      "latitude" => depot.latitude.to_s,
      "longitude" => depot.longitude.to_s,
      "accepts_new_members" => depot.accepts_new_members,
      "is_established" => depot.is_established,
      "description" => depot.description,
      "contact_name" => depot.contact_name,
      "contact_phone" => depot.contact_phone,
      "updated_at" => depot.updated_at.to_json.gsub("\"", ''),
      "type" => depot.type,
      "products" => depot.products,
      "user_id" => depot.user_id }
  end

  def expected_show_response_for(depot)
    expected_index_response_for(depot).merge(
      { "places" => depot.places }
    )
  end

  shared_examples_for "a readable depot" do
    it "returns a depot" do
      get "#{url}/depots/#{@depot1.id}", auth_token: token

      expect(last_response.status).to eq(200)
      response = JSON.parse(last_response.body)
      expect(response).to eq(expected_show_response_for(@depot1))
    end

{'fraction_non_alphanumeric': 0.15078495801387368, 'fraction_numerical': 0.008032128514056224, 'mean_word_length': 3.3354430379746836, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 35, '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': '782395', 'n_tokens_mistral': 1025, 'n_tokens_neox': 983, 'n_words': 174}