You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fetcher_spec.rb 945B

1234567891011121314151617181920212223242526272829303132
  1. require 'dotenv/load'
  2. require_relative '../lib/auth'
  3. require_relative '../lib/fetcher'
  4. RSpec.describe Fetcher do
  5. let(:cookie) { login(ENV['VLV_USERNAME'], ENV['VLV_PASSWORD']) }
  6. let(:thread_id) { 49668 }
  7. subject { Fetcher.new(cookie: cookie) }
  8. describe '#thread' do
  9. it "fetches a thread" do
  10. result = subject.thread({ remote_id: 49668 })
  11. aggregate_failures do
  12. expect(result).to be_a(Nokogiri::HTML::Document)
  13. expect(result.at_css('.post:first-child').text)
  14. .to include('reddwarf posted this March 30th, 2020 @ 3:29:23 am')
  15. end
  16. end
  17. end
  18. describe '#page' do
  19. it "fetches a page of threads" do
  20. result = subject.page(0)
  21. aggregate_failures do
  22. expect(result).to be_a(Nokogiri::HTML::Document)
  23. expect(result.at_css('h3').text).to eq('VLV: politics, food, and aging')
  24. expect(result.css('.even, .odd').length).to eq(110)
  25. end
  26. end
  27. end
  28. end