Just kill off VCR. We love it but it doesn't work with Watir.

This commit is contained in:
Jon 2019-08-14 09:50:57 -04:00
parent c08a880b51
commit 5f5710fedc
4 changed files with 3 additions and 211 deletions

View file

@ -5,4 +5,3 @@ gem 'nokogiri'
gem 'webdrivers' gem 'webdrivers'
gem 'minitest' gem 'minitest'
gem 'webmock' gem 'webmock'
gem 'vcr'

View file

@ -20,7 +20,6 @@ GEM
selenium-webdriver (3.142.3) selenium-webdriver (3.142.3)
childprocess (>= 0.5, < 2.0) childprocess (>= 0.5, < 2.0)
rubyzip (~> 1.2, >= 1.2.2) rubyzip (~> 1.2, >= 1.2.2)
vcr (5.0.0)
watir (6.16.5) watir (6.16.5)
regexp_parser (~> 1.2) regexp_parser (~> 1.2)
selenium-webdriver (~> 3.6) selenium-webdriver (~> 3.6)
@ -39,7 +38,6 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
minitest minitest
nokogiri nokogiri
vcr
watir watir
webdrivers webdrivers
webmock webmock

File diff suppressed because one or more lines are too long

View file

@ -1,22 +1,13 @@
require 'minitest/autorun' require 'minitest/autorun'
require 'webdrivers/chromedriver' require 'webdrivers/chromedriver'
require 'vcr'
require_relative '../../lib/lunch_scraper' require_relative '../../lib/lunch_scraper'
VCR.configure do |config|
config.cassette_library_dir = "test/cassettes/"
config.ignore_hosts('127.0.0.1')
config.ignore_hosts(*(ObjectSpace.each_object(Webdrivers::Common.singleton_class).to_a - [Webdrivers::Common]).map { |driver| URI(driver.base_url).host })
config.hook_into :webmock
end
class LunchScraperTest < MiniTest::Spec class LunchScraperTest < MiniTest::Spec
describe "Getting today's lunch" do describe "Getting today's lunch" do
it 'can parse out the correct lunch items' do it 'can parse out the correct lunch items' do
VCR.use_cassette('14Aug2019-Lunch') do
@lunch = LunchScraper.new(Date.today) @lunch = LunchScraper.new(Date.today)
puts @lunch.today.inspect @lunch.today.size.must_equal 6
end @lunch.today.first.must_equal 'French Bread Pizza'
end end
end end
end end