<commit_before>require "spec_helper"

describe OpenStates::Api do
  before { OpenStates.stub(:get).and_return({}) }

  describe ".metadata" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.metadata
    end

    context "without a state passed" do
      it "should call .get with 'metadata/'" do
        expect(OpenStates).to receive(:get).with("metadata/")
        OpenStates.metadata
      end
    end

    context "with a state passed in" do
      it "should call .get with 'metadata/in/'" do
        state = "in"
        expect(OpenStates).to receive(:get).with("metadata/#{state}/")
        OpenStates.metadata(state)
      end
    end
  end

  describe ".bills" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.bills
    end

    context "without an options hash passed" do
      it "should call .get with 'bills/' and an empty hash" do
        expect(OpenStates).to receive(:get).with("bills/", {})
        OpenStates.bills
      end
    end

    context "with an options hash passed" do
      it "should call .get with 'bills/in/summer/10' and an options hash" do
        options = {:state => "in", :session => "summer", :bill_id => 10}
        expect(OpenStates).to receive(:get).with("bills/#{options[:state]}/#{options[:session]}/#{options[:bill_id]}", options)
        OpenStates.bills(options)
      end
    end
  end

  describe ".legislators" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.legislators
    end

    context "without an options hash passed" do
      it "should call .get with 'legislators/' and an empty hash" do
        expect(OpenStates).to receive(:get).with("legislators/", {})
        OpenStates.legislators
      end
    end

    context "with an options hash passed" do
      it "should call .get with 'legislators/' and an options hash" do
        options = {:leg_id => 1}
        expect(OpenStates).to receive(:get).with("legislators/#{options[:leg_id]}/", options)
        OpenStates.legislators(options)
      end
    end
  end

  describe ".geo_legislators" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.geo_legislators(nil, nil)
    end

    it "should call .get with 'legislators/geo/' and a hash with lat/lon" do
      lat, lon = 10,10
      expect(OpenStates).to receive(:get).with("legislators/geo/", {:lat => lat, :lon => lon})
      OpenStates.geo_legislators(lat, lon)
    end
  end

  describe ".committees" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.committees
    end

    context "without an options hash passed" do
      it "should call .get with 'committees/' and an empty hash" do
        expect(OpenStates).to receive(:get).with("committees/", {})
        OpenStates.committees
      end
    end

    context "with an options hash passed" do
      it "should call .get with 'committees/' and an options hash" do
        options = {:committee_id => 1}
        expect(OpenStates).to receive(:get).with("committees/#{options[:committee_id]}/", options)
        OpenStates.committees(options)
      end
    end
  end

  describe ".events" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.events
    end<commit_msg>Fix misspelled hash key in api spec<commit_after>require "spec_helper"

describe OpenStates::Api do
  before { OpenStates.stub(:get).and_return({}) }

  describe ".metadata" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.metadata
    end

    context "without a state passed" do
      it "should call .get with 'metadata/'" do
        expect(OpenStates).to receive(:get).with("metadata/")
        OpenStates.metadata
      end
    end

    context "with a state passed in" do
      it "should call .get with 'metadata/in/'" do
        state = "in"
        expect(OpenStates).to receive(:get).with("metadata/#{state}/")
        OpenStates.metadata(state)
      end
    end
  end

  describe ".bills" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.bills
    end

    context "without an options hash passed" do
      it "should call .get with 'bills/' and an empty hash" do
        expect(OpenStates).to receive(:get).with("bills/", {})
        OpenStates.bills
      end
    end

    context "with an options hash passed" do
      it "should call .get with 'bills/in/summer/10' and an options hash" do
        options = {:state => "in", :session => "summer", :bill_id => 10}
        expect(OpenStates).to receive(:get).with("bills/#{options[:state]}/#{options[:session]}/#{options[:bill_id]}", options)
        OpenStates.bills(options)
      end
    end
  end

  describe ".legislators" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.legislators
    end

    context "without an options hash passed" do
      it "should call .get with 'legislators/' and an empty hash" do
        expect(OpenStates).to receive(:get).with("legislators/", {})
        OpenStates.legislators
      end
    end

    context "with an options hash passed" do
      it "should call .get with 'legislators/' and an options hash" do
        options = {:leg_id => 1}
        expect(OpenStates).to receive(:get).with("legislators/#{options[:leg_id]}/", options)
        OpenStates.legislators(options)
      end
    end
  end

  describe ".geo_legislators" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.geo_legislators(nil, nil)
    end

    it "should call .get with 'legislators/geo/' and a hash with lat/lon" do
      lat, lon = 10,10
      expect(OpenStates).to receive(:get).with("legislators/geo/", {:lat => lat, :long => lon})
      OpenStates.geo_legislators(lat, lon)
    end
  end

  describe ".committees" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.committees
    end

    context "without an options hash passed" do
      it "should call .get with 'committees/' and an empty hash" do
        expect(OpenStates).to receive(:get).with("committees/", {})
        OpenStates.committees
      end
    end

    context "with an options hash passed" do
      it "should call .get with 'committees/' and an options hash" do
        options = {:committee_id => 1}
        expect(OpenStates).to receive(:get).with("committees/#{options[:committee_id]}/", options)
        OpenStates.committees(options)
      end
    end
  end

  describe ".events" do
    it "should call .get on OpenStates" do
      expect(OpenStates).to receive(:get)
      OpenStates.events
    end
{'fraction_non_alphanumeric': 0.1164793460808641, 'fraction_numerical': 0.002919281856663261, 'mean_word_length': 2.6818914562063405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '3921920', 'n_tokens_mistral': 2097, 'n_tokens_neox': 2024, 'n_words': 633}