Sha256: 0604c899c1860fe1027174c7f144c2cfd875f5f6f4d590cf5d8a31d29d539c99

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe Elasticrawl::CrawlSegment, type: :model do
  it { should belong_to(:crawl) }
  it { should have_many(:job_steps) }
  it { should have_db_column(:segment_name).of_type(:string) }
  it { should have_db_column(:segment_s3_uri).of_type(:string) }
  it { should have_db_column(:parse_time).of_type(:datetime) }
  it { should have_db_column(:file_count).of_type(:integer) }

  describe '.create_segment' do
    let(:crawl) { Elasticrawl::Crawl.create(:crawl_name => 'CC-MAIN-2014-49') }
    let(:segment_name) { '1416400372202.67' }
    let(:file_count) { 3 }
    let(:segment_desc) { 'Segment: 1416400372202.67 Files: 3' }
    subject { Elasticrawl::CrawlSegment.create_segment(crawl,
                                                       segment_name,
                                                       file_count) }
    it 'should have a segment name' do
      expect(subject.segment_name).to eq segment_name
    end

    it 'should have an s3 uri' do
      expect(subject.segment_s3_uri).to eq \
        "s3://commoncrawl/crawl-data/#{crawl.crawl_name}/segments/#{segment_name}/"
    end

    it 'should have a file count' do
      expect(subject.file_count).to eq file_count
    end

    it 'should have a segment description' do
      expect(subject.segment_desc).to eq segment_desc
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
elasticrawl-1.1.8 spec/unit/crawl_segment_spec.rb
elasticrawl-1.1.7 spec/unit/crawl_segment_spec.rb
elasticrawl-1.1.6 spec/unit/crawl_segment_spec.rb