|
@@ -10,22 +10,26 @@ RSpec.describe Fetcher do
|
10
|
10
|
|
11
|
11
|
describe '#thread' do
|
12
|
12
|
it "fetches a thread" do
|
13
|
|
- result = subject.thread({ remote_id: 49668 })
|
14
|
|
- aggregate_failures do
|
15
|
|
- expect(result).to be_a(Nokogiri::HTML::Document)
|
16
|
|
- expect(result.at_css('.post:first-child').text)
|
17
|
|
- .to include('reddwarf posted this March 30th, 2020 @ 3:29:23 am')
|
|
13
|
+ VCR.use_cassette "fetch_a_thread" do
|
|
14
|
+ result = subject.thread({ remote_id: 49668 })
|
|
15
|
+ aggregate_failures do
|
|
16
|
+ expect(result).to be_a(Nokogiri::HTML::Document)
|
|
17
|
+ expect(result.at_css('.post:first-child').text)
|
|
18
|
+ .to include('reddwarf posted this March 30th, 2020 @ 3:29:23 am')
|
|
19
|
+ end
|
18
|
20
|
end
|
19
|
21
|
end
|
20
|
22
|
end
|
21
|
23
|
|
22
|
24
|
describe '#page' do
|
23
|
25
|
it "fetches a page of threads" do
|
24
|
|
- result = subject.page(0)
|
25
|
|
- aggregate_failures do
|
26
|
|
- expect(result).to be_a(Nokogiri::HTML::Document)
|
27
|
|
- expect(result.at_css('h3').text).to eq('VLV: politics, food, and aging')
|
28
|
|
- expect(result.css('.even, .odd').length).to eq(110)
|
|
26
|
+ VCR.use_cassette "fetch_a_page_of_threads" do
|
|
27
|
+ result = subject.page(0)
|
|
28
|
+ aggregate_failures do
|
|
29
|
+ expect(result).to be_a(Nokogiri::HTML::Document)
|
|
30
|
+ expect(result.at_css('h3').text).to eq('VLV: politics, food, and aging')
|
|
31
|
+ expect(result.css('.even, .odd').length).to eq(110)
|
|
32
|
+ end
|
29
|
33
|
end
|
30
|
34
|
end
|
31
|
35
|
end
|