<commit_before>require "support/object_graph_setup"
RSpec.shared_context "seed data setup" do
  include_context "object graph setup"

  before {
    seeded_records.each do |(namespace, record)|
      datastore[namespace].insert(record)
    end
  }

  let(:seeded_records) {
    [
      [ :users, hansel_record ],
      [ :users, jasper_record ],
      [ :users, poppy_record ],
      [ :posts, biscuits_post_record ],
      [ :posts, sleep_post_record ],
      [ :posts, catch_frogs_post_record ],
      [ :posts, chew_up_boxes_post_record ],
      [ :comments, biscuits_post_comment_record ],
      [ :categories, cat_biscuits_category_record ],
      [ :categories, eating_and_sleeping_category_record ],
      [ :categories, hunting_category_record ],
      [ :categories, messing_stuff_up_category_record ],
      *categories_to_posts_records.map { |record|
        [ :categories_to_posts, record ]
      },
    ]
  }

  let(:hansel_record) {
    {
      id: "users/1",
      first_name: "Hansel",
      last_name: "Trickett",
      email: "<EMAIL>",
    }
  }

  let(:jasper_record) {
    {
      id: "users/2",
      first_name: "Jasper",
      last_name: "Trickett",
      email: "<EMAIL>",
    }
  }

  let(:poppy_record) {
    {
      id: "users/3",
      first_name: "Poppy",
      last_name: "Herzog",
      email: "<EMAIL>",
    }
  }

  let(:biscuits_post_record) {
    {
      id: "posts/1",
      subject: "Biscuits",
      body: "I like them",
      author_id: "users/1",
      created_at: Time.parse("2015-09-05T15:00:00+01:00"),
    }
  }

  let(:sleep_post_record) {
    {
      id: "posts/2",
      subject: "Sleeping",
      body: "I do it three times purrr day",
      author_id: "users/1",
      created_at: Time.parse("2015-09-02T15:00:00+01:00"),
    }
  }

  let(:catch_frogs_post_record) {
    {
      id: "posts/3",
      subject: "Catching frongs",
      body: "I love them while at the same time I hate them",
      author_id: "users/2",
      created_at: Time.parse("2015-09-03T15:00:00+01:00"),
    }
  }

  let(:chew_up_boxes_post_record) {<commit_msg>Dates in seed data incorrect and inconsistent with tests<commit_after>require "support/object_graph_setup"
RSpec.shared_context "seed data setup" do
  include_context "object graph setup"

  before {
    seeded_records.each do |(namespace, record)|
      datastore[namespace].insert(record)
    end
  }

  let(:seeded_records) {
    [
      [ :users, hansel_record ],
      [ :users, jasper_record ],
      [ :users, poppy_record ],
      [ :posts, biscuits_post_record ],
      [ :posts, sleep_post_record ],
      [ :posts, catch_frogs_post_record ],
      [ :posts, chew_up_boxes_post_record ],
      [ :comments, biscuits_post_comment_record ],
      [ :categories, cat_biscuits_category_record ],
      [ :categories, eating_and_sleeping_category_record ],
      [ :categories, hunting_category_record ],
      [ :categories, messing_stuff_up_category_record ],
      *categories_to_posts_records.map { |record|
        [ :categories_to_posts, record ]
      },
    ]
  }

  let(:hansel_record) {
    {
      id: "users/1",
      first_name: "Hansel",
      last_name: "Trickett",
      email: "<EMAIL>",
    }
  }

  let(:jasper_record) {
    {
      id: "users/2",
      first_name: "Jasper",
      last_name: "Trickett",
      email: "<EMAIL>",
    }
  }

  let(:poppy_record) {
    {
      id: "users/3",
      first_name: "Poppy",
      last_name: "Herzog",
      email: "<EMAIL>",
    }
  }

  let(:biscuits_post_record) {
    {
      id: "posts/1",
      subject: "Biscuits",
      body: "I like them",
      author_id: "users/1",
      created_at: Time.parse("2015-09-02T15:00:00+01:00"),
    }
  }

  let(:sleep_post_record) {
    {
      id: "posts/2",
      subject: "Sleeping",
      body: "I do it three times purrr day",
      author_id: "users/1",
      created_at: Time.parse("2015-09-03T15:00:00+01:00"),
    }
  }

  let(:catch_frogs_post_record) {
    {
      id: "posts/3",
      subject: "Catching frongs",
      body: "I love them while at the same time I hate them",
      author_id: "users/2",
      created_at: Time.parse("2015-09-05T15:00:00+01:00"),
    }
  }

  let(:chew_up_boxes_post_record) {
{'fraction_non_alphanumeric': 0.14146688820318062, 'fraction_numerical': 0.029907429385236172, 'mean_word_length': 2.6233877901977642, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1859489', 'n_tokens_mistral': 1613, 'n_tokens_neox': 1519, 'n_words': 262}