<commit_before>require 'rails_helper'

module Yoolk
  module Liquid
    describe InstantWebsite::WebsiteDrop do
      it { should have_attribute(:id) }
      it { should have_attribute(:template_name) }
      it { should have_attribute(:color) }
      it { should have_attribute(:google_analytics_key) }
      it { should have_attribute(:is_live) }
      it { should have_attribute(:is_active) }
      it { should have_attribute(:free_plan) }
      it { should have_attribute(:primary_domain) }
      it { should have_attribute(:created_at) }
      it { should have_attribute(:updated_at) }

      it { should belongs_to(:favicon).with('Yoolk::Liquid::AttachmentDrop') }
      it { should belongs_to(:template).with('Yoolk::Liquid::InstantWebsite::TemplateDrop') }
      it { should have_many(:domains).with('Yoolk::Liquid::InstantWebsite::DomainDrop') }
      it { should have_many(:page_labels).with('Yoolk::Liquid::InstantWebsite::PageLabelDrop') }
    end

    describe InstantWebsite::WebsiteDrop do
      let(:template)  { build(:instant_website_template, dimension: '200x400') }
      let(:website1)  { build(:instant_website_website, :cover_photos, template: template, dimensions: ['200x400', '400x200']) }
      let(:website2)  { build(:instant_website_website, :cover_photos, template: template, dimensions: ['200x400', '400x200']) }
      let(:drop1)     { website1.to_liquid }
      let(:drop2)     { website2.to_liquid }

      before          {
        drop1.context = context
        drop2.context = context
      }

      it { should respond_to(:office_url) }

      context '#cover_photos' do
        it 'returns an instance of Liquid::Rails::CollectionDrop', :focus do
          expect(drop1.cover_photos).to be_instance_of(::Liquid::Rails::CollectionDrop)
        end

        it 'returns the cover_photos that matches its template' do
          expect(drop1.cover_photos.length).to eq(1)
          expect(drop1.cover_photos[0].dimension).to eq(template.cover_photo.dimension)
        end

        it 'returns empty array when template doesn\'t have cover_photo' do
          template.cover_photo = nil

          expect(drop1.cover_photos.length).to eq(0)<commit_msg>[#89071038] update website drop spec<commit_after>require 'rails_helper'

module Yoolk
  module Liquid
    describe InstantWebsite::WebsiteDrop do
      it { should have_attribute(:id) }
      it { should have_attribute(:template_name) }
      it { should have_attribute(:color) }
      it { should have_attribute(:google_analytics_key) }
      it { should have_attribute(:is_live) }
      it { should have_attribute(:is_active) }
      it { should have_attribute(:free_plan) }
      it { should have_attribute(:primary_domain) }
      it { should have_attribute(:created_at) }
      it { should have_attribute(:updated_at) }

      it { should belongs_to(:favicon).with('Yoolk::Liquid::AttachmentDrop') }
      it { should belongs_to(:template).with('Yoolk::Liquid::InstantWebsite::TemplateDrop') }
      it { should have_many(:domains).with('Yoolk::Liquid::InstantWebsite::DomainDrop') }
      it { should have_many(:page_labels).class_name('Yoolk::Liquid::InstantWebsite::PageLabelsDrop').with('Yoolk::Liquid::InstantWebsite::PageLabelDrop') }
    end

    describe InstantWebsite::WebsiteDrop do
      let(:template)  { build(:instant_website_template, dimension: '200x400') }
      let(:website1)  { build(:instant_website_website, :cover_photos, template: template, dimensions: ['200x400', '400x200']) }
      let(:website2)  { build(:instant_website_website, :cover_photos, template: template, dimensions: ['200x400', '400x200']) }
      let(:drop1)     { website1.to_liquid }
      let(:drop2)     { website2.to_liquid }

      before          {
        drop1.context = context
        drop2.context = context
      }

      it { should respond_to(:office_url) }

      context '#cover_photos' do
        it 'returns an instance of Liquid::Rails::CollectionDrop', :focus do
          expect(drop1.cover_photos).to be_instance_of(::Liquid::Rails::CollectionDrop)
        end

        it 'returns the cover_photos that matches its template' do
          expect(drop1.cover_photos.length).to eq(1)
          expect(drop1.cover_photos[0].dimension).to eq(template.cover_photo.dimension)
        end

        it 'returns empty array when template doesn\'t have cover_photo' do
          template.cover_photo = nil

          expect(drop1.cover_photos.length).to eq(0)
{'fraction_non_alphanumeric': 0.11711913843392416, 'fraction_numerical': 0.02198788422705856, 'mean_word_length': 3.5864197530864197, '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': '2558956', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1307, 'n_words': 261}