<commit_before>require "spec_helper"

describe PanoramioRb do
  describe "parameters" do
    it "has a version number" do
      expect(PanoramioRb::VERSION).not_to be nil
    end

    it "has a default url" do
      expect(PanoramioRb::URL).not_to be nil
    end

    it "has default options" do
      expect(PanoramioRb::DEFAULT_OPTIONS).not_to be nil
    end
  end

  describe "method" do
    describe ".get_panoramas" do
      context "without options" do
        it "get panoramas successfuly with default options" do
          panoramio = PanoramioRb.get_panoramas

          expect(panoramio.photos).not_to be nil
          expect(panoramio.photos.count).to eq(20)
        end
      end
      context "with area options" do
        it "get panoramas within area" do
          area = {
            minx: '-72.69483717012992', 
            miny: '-13.307931783110847', 
            maxx: '-72.39756282987008', 
            maxy: '-13.018468216889152'
          }
          panoramio = PanoramioRb.get_panoramas(area)

          photo = panoramio.photos.first

          expect(photo.latitude).to be_within(area[:minx]).of(area[:maxx])
        end
      end
    end
  end 
end<commit_msg>Get panoramas with area options<commit_after>require "spec_helper"

describe PanoramioRb do
  describe "parameters" do
    it "has a version number" do
      expect(PanoramioRb::VERSION).not_to be nil
    end

    it "has a default url" do
      expect(PanoramioRb::URL).not_to be nil
    end

    it "has default options" do
      expect(PanoramioRb::DEFAULT_OPTIONS).not_to be nil
    end
  end

  describe "methods" do
    describe ".get_panoramas" do
      context "without options" do
        it "get panoramas successfuly with default options" do
          panoramio = PanoramioRb.get_panoramas

          expect(panoramio.photos).not_to be nil
          expect(panoramio.photos.count).to eq(20)
        end
      end
      context "with area options" do
        it "get panoramas within area" do
          area = {
            minx: -72.69483717012992, 
            miny: -13.307931783110847, 
            maxx: -72.39756282987008, 
            maxy: -13.018468216889152
          }
          panoramio = PanoramioRb.get_panoramas(area)

          photo = panoramio.photos.first

          expect(photo.latitude).to be_between(area[:miny], area[:maxy])
          expect(photo.longitude).to be_between(area[:minx], area[:maxx])
        end
      end
    end
  end 
end
{'fraction_non_alphanumeric': 0.08397565922920892, 'fraction_numerical': 0.05517241379310345, 'mean_word_length': 2.1778350515463916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2812730', 'n_tokens_mistral': 921, 'n_tokens_neox': 796, 'n_words': 199}