123456789101112131415161718192021222324252627282930 |
- require 'dotenv/load'
- require 'spec_helper'
-
- require_relative '../db/scraper'
-
- RSpec.describe Scraper do
- around(:each) do |example|
- DB.transaction(rollback: :always, auto_savepoint: true) { example.run }
- end
-
- subject { described_class.new(log: true) }
-
- describe '#initialize' do
- it 'authenticates' do
- VCR.use_cassette "authentication" do
- expect(subject.send(:cookie)).to_not be_nil
- end
- end
- end
-
- describe '#scrape' do
- it 'creates new threads and posts' do
- VCR.use_cassette "create_new_threads_and_posts" do
- expect { subject.scrape }
- .to change { VLV::Thread.count }.by(109)
- .and change { VLV::Post.count }.by_at_least(5000)
- end
- end
- end
- end
|