<commit_before>require 'rails_helper'

RSpec.describe SyncVenue, type: :model do
  # pending "add some examples to (or delete) #{__FILE__}"
  
  describe '#_collect_uris_and_search_terms' do
    subject { SyncVenue._collect_uris_and_search_terms }
    let(:tp_hotels) { File.read( Rails.root + 'spec/support/fixtures/tp_hotels.html' ) }
    let(:fsq_contemporay_baylake_tower) { File.read( Rails.root +
       'spec/support/fixtures/bay-lake-tower-at-contemporary.json' ) }
    let(:fsq_all_star_movies_query) { File.read( Rails.root + 'spec/support/fixtures/all-star-movies.json' ) }
    
    
    before do
      stub_request(:get, "https://api.foursquare.com/v2/venues/search/?client_id=R1TDM0FYS2YSOFTWG2QU2DS0OE00BZLMQCQPMKUGO5CJGNYH&client_secret=1N5G1D22C2410VE3RJXPS10Y31E2WA0BT45KYJFTGR0S35QN&ll=28.37777,-81.56498&query=disneyworld.disney.go.com/resorts/all-star-movies-resort/%20resort&v=20160607&verified=true").
        with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
        to_return(:status => 200, :body => "", :headers => {})
    
      
      # stub_request(:get, "https://api.foursquare.com/v2/venues/search/?client_id=R1TDM0FYS2YSOFTWG2QU2DS0OE00BZLMQCQPMKUGO5CJGNYH&client_secret=1N5G1D22C2410VE3RJXPS10Y31E2WA0BT45KYJFTGR0S35QN&ll=28.37777,-81.56498&query=disneyworld.disney.go.com/resorts/all-star-music-resort/%20resort&v=20160607&verified=true").
      #   with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
      #   to_return(:status => 200, :body => fsq_all_star_movies_query, :headers => {})
    
        stub_request(:get, "https://api.foursquare.com/v2/venues/search/?client_id=R1TDM0FYS2YSOFTWG2QU2DS0OE00BZLMQCQPMKUGO5CJGNYH&client_secret=1N5G1D22C2410VE3RJXPS10Y31E2WA0BT45KYJFTGR0S35QN&ll=28.37777,-81.56498&query=disneyworld.disney.go.com/resorts/bay-lake-tower-at-contemporary/%20resort&v=20160607&verified=true").
        with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
        to_return(:status => 200, :body => fsq_contemporay_baylake_tower, :headers => {})
      
      stub_request(:get, "https://touringplans.com/walt-disney-world/hotels/websites").
        with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
        to_return(:status => 200, :body => tp_hotels, :headers => {})
        
    end
    
    # it 'works' do
    #   expect(subject).to eq("something")
    # end
    
    it 'returns an Array' do
      expect(subject).to be_an(Array)
    end

    it 'returns an Array with a length 30, give or take 29' do
      expect(subject.length).to be_within(29).of(30)
    end
    
    it 'has a string as the first element' do
      expect(subject.first).to be_a(String)
    end

    it 'has a string as the last element' do
      expect(subject.last).to be_a(String)
    end

  end
  
  describe '#_wdw_uris' do<commit_msg>CHANGED: took out stale foursqaure key and secret<commit_after>require 'rails_helper'

RSpec.describe SyncVenue, type: :model do
  # pending "add some examples to (or delete) #{__FILE__}"
  
  describe '#_collect_uris_and_search_terms' do
    subject { SyncVenue._collect_uris_and_search_terms }
    let(:tp_hotels) { File.read( Rails.root + 'spec/support/fixtures/tp_hotels.html' ) }
    let(:fsq_contemporay_baylake_tower) { File.read( Rails.root +
       'spec/support/fixtures/bay-lake-tower-at-contemporary.json' ) }
    let(:fsq_all_star_movies_query) { File.read( Rails.root + 'spec/support/fixtures/all-star-movies.json' ) }
    
    
    before do
      # stub_request(:get, "https://api.foursquare.com/v2/venues/search/?client_id=#{FOURSQUARE_ID}&client_secret=#{FOURSQUARE_SECRET}&ll=28.37777,-81.56498&query=disneyworld.disney.go.com/resorts/all-star-movies-resort/%20resort&v=20160607&verified=true").
      #   with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
      #   to_return(:status => 200, :body => "", :headers => {})
    
      
      # # stub_request(:get, "https://api.foursquare.com/v2/venues/search/?client_id=R1TDM0FYS2YSOFTWG2QU2DS0OE00BZLMQCQPMKUGO5CJGNYH&client_secret=1N5G1D22C2410VE3RJXPS10Y31E2WA0BT45KYJFTGR0S35QN&ll=28.37777,-81.56498&query=disneyworld.disney.go.com/resorts/all-star-music-resort/%20resort&v=20160607&verified=true").
      # #   with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
      # #   to_return(:status => 200, :body => fsq_all_star_movies_query, :headers => {})
    
      #   stub_request(:get, "https://api.foursquare.com/v2/venues/search/?client_id=#{FOURSQUARE_ID}&client_secret=#{FOURSQUARE_SECRET}&ll=28.37777,-81.56498&query=disneyworld.disney.go.com/resorts/bay-lake-tower-at-contemporary/%20resort&v=20160607&verified=true").
      #   with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
      #   to_return(:status => 200, :body => fsq_contemporay_baylake_tower, :headers => {})
      
      # stub_request(:get, "https://touringplans.com/walt-disney-world/hotels/websites").
      #   with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
      #   to_return(:status => 200, :body => tp_hotels, :headers => {})

      stub_request(:get, "https://touringplans.com/walt-disney-world/hotels/websites").
         with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}).
         to_return(:status => 200, :body => "", :headers => {})        
    end
    
    # it 'works' do
    #   expect(subject).to eq("something")
    # end
    
    it 'returns an Array' do
      expect(subject).to be_an(Array)
    end

    it 'returns an Array with a length 30, give or take 29' do
      expect(subject.length).to be_within(29).of(30)
    end
    
    it 'has a string as the first element' do
      expect(subject.first).to be_a(String)
    end

    it 'has a string as the last element' do
      expect(subject.last).to be_a(String)
    end

  end
  
  describe '#_wdw_uris' do
{'fraction_non_alphanumeric': 0.1773989898989899, 'fraction_numerical': 0.0579229797979798, 'mean_word_length': 4.127022653721683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 66, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3372861', 'n_tokens_mistral': 2740, 'n_tokens_neox': 2541, 'n_words': 288}