<commit_before>require 'spec_helper'

describe TemplatesController do

  describe 'GET templates' do

    it "returns the list of templates" do
      get :index, format: :json
      expect(response.body).to include(TemplateSerializer.new(Template.first).to_json)
    end

    it "returns a specific template" do
      get :show, { id: Template.first.id, format: :json }
      expect(response.body).to eq TemplateSerializer.new(Template.first).to_json
    end

  end

end<commit_msg>adding test for array of templates rather than just the presence of one template in the response<commit_after>require 'spec_helper'

describe TemplatesController do

  describe 'GET templates' do

    it "returns the list of templates" do
      get :index, format: :json
      expect(JSON.parse(response.body)).to be_an Array
      expect(response.body).to include(TemplateSerializer.new(Template.first).to_json)
    end

    it "returns a specific template" do
      get :show, { id: Template.first.id, format: :json }
      expect(response.body).to eq TemplateSerializer.new(Template.first).to_json
    end

  end

end
{'fraction_non_alphanumeric': 0.08802177858439202, 'fraction_numerical': 0.0, 'mean_word_length': 3.654008438818565, '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': '4730755', 'n_tokens_mistral': 320, 'n_tokens_neox': 309, 'n_words': 100}