<commit_before>require 'spec_helper'

describe Sketchfably do
  describe "tag query" do
    subject { Sketchfably.get_models_by_tag("proejctmosul") }

    its(:size){ should eq(1) }
  end

  describe "tag query models" do
    subject { Sketchfably.get_models_by_tag("projectmosul").first }
    its(:class){ should eq(SketchfabModel) }
    its(:id){ should eq("55ea0aed9bfd462593f006ea8c4aade0") }
    its(:username){ should eq("neshmi") }
    its(:name){ should eq("The Lion of Mosul") }
  end

  describe "html template" do
    def model
      Sketchfably.get_models_by_tag("projectmosul").first
    end

    def html_template
      File.read(File.join(File.dirname(__FILE__),"fixtures","embed_code"))
    end
    
    it "should render html for a model" do
      expect(Sketchfably.get_html_for_model model).to eq(html_template)
    end
  end
<commit_msg>models output their own html template<commit_after>require 'spec_helper'

describe Sketchfably do
  describe "tag query" do
    subject { Sketchfably.get_models_by_tag("proejctmosul") }

    its(:size){ should eq(1) }
  end

  describe "tag query models" do
    subject { Sketchfably.get_models_by_tag("projectmosul").first }
    its(:class){ should eq(SketchfabModel) }
    its(:id){ should eq("55ea0aed9bfd462593f006ea8c4aade0") }
    its(:username){ should eq("neshmi") }
    its(:name){ should eq("The Lion of Mosul") }
  end

  describe "html template" do
    def model
      Sketchfably.get_models_by_tag("projectmosul").first
    end

    def html_template
      File.read(File.join(File.dirname(__FILE__),"fixtures","embed_code"))
    end
    
    it "should render html for a model" do
      expect(Sketchfably.get_html_for_model model).to eq(html_template)
    end

    it "a model should have its own html template" do
      expect(model.html).to eq(html_template)
    end
  end

{'fraction_non_alphanumeric': 0.10828370330265295, 'fraction_numerical': 0.018408229561451002, 'mean_word_length': 3.8125, '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': '4859088', 'n_tokens_mistral': 651, 'n_tokens_neox': 627, 'n_words': 144}