<commit_before>require 'spec_helper'

describe Api::V1::HeadingsController, "GET #show" do
  render_views

  let(:heading) { create :heading, :non_declarable, :with_description, :with_chapter }
  let(:pattern) {
    {
      goods_nomenclature_item_id: heading.code,
      description: String,
      commodities: Array,
      chapter: Hash
    }.ignore_extra_keys!
  }

  context 'when record is present' do
    it 'returns rendered record' do
      get :show, id: heading, format: :json

      response.body.should match_json_expression pattern
    end
  end

  context 'when record is not present' do
    it 'returns not found if record was not found' do
      expect { get :show, id: "0101", format: :json }.to raise_error Sequel::RecordNotFound
    end
  end
end<commit_msg>The heading should not exist.<commit_after>require 'spec_helper'

describe Api::V1::HeadingsController, "GET #show" do
  render_views

  let(:heading) { create :heading, :non_declarable, :with_description, :with_chapter }
  let(:pattern) {
    {
      goods_nomenclature_item_id: heading.code,
      description: String,
      commodities: Array,
      chapter: Hash
    }.ignore_extra_keys!
  }

  context 'when record is present' do
    it 'returns rendered record' do
      get :show, id: heading, format: :json

      response.body.should match_json_expression pattern
    end
  end

  context 'when record is not present' do
    it 'returns not found if record was not found' do
      expect { get :show, id: "5555", format: :json }.to raise_error Sequel::RecordNotFound
    end
  end
end
{'fraction_non_alphanumeric': 0.0910828025477707, 'fraction_numerical': 0.006369426751592357, 'mean_word_length': 3.4630681818181817, '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': '930067', 'n_tokens_mistral': 495, 'n_tokens_neox': 476, 'n_words': 155}