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 expect(subject.send(:cookie)).to_not be_nil 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