Sha256: 27080e2750a0d77c2265b73904297bb98da9262817e88b72b1bef4cbf27168ce

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

require "helper"
require "pp"

class TestProceeding < MiniTest::Unit::TestCase
  
  def test_find
    VCR.use_cassette('main_cassette') do
      proceeding = ECFS::Proceeding.find("12-375")
      %w[
        bureau_name subject date_created status
        total_filings filings_in_last_30_days
        docket_number
      ].each do |key|
        assert proceeding.keys.include?(key)
      end

      assert_equal ECFS::Proceeding, proceeding.class
    end
  end

  def test_search
    VCR.use_cassette('main_cassette') do

      proceedings = ECFS::Proceeding.query.tap do |q|
        q.bureau_code = "WC"
        q.page_number = "1"
        q.per_page    = "100"
      end.get

      %w[
        total_pages first_result last_result total_results
        current_page constraints fcc_url results
      ].each do |key|
        assert proceedings.keys.include?(key)
        assert proceedings[key]
      end

      assert_equal ECFS::Proceeding::ResultSet, proceedings.class
      assert_equal ECFS::ProceedingsQuery, proceedings.next_query.class
      next_proceedings = proceedings.next
      assert_equal ECFS::Proceeding::ResultSet, next_proceedings.class

      prison_phones = proceedings["results"].select {|p| p["docket_number"] == "12-375"}.first
      prison_phones.fetch_filings!

      assert_equal Array, prison_phones["filings"].class

      prison_phones = proceedings["results"].select {|p| p["docket_number"] == "12-375"}.first
      assert_equal ECFS::Proceeding, prison_phones.class
      fetched = prison_phones.fetch_info!
      assert_equal ECFS::Proceeding, prison_phones.class
      %w[
        bureau_name subject date_created status
        total_filings filings_in_last_30_days
      ].each do |key|
        assert prison_phones.keys.include?(key)
      end

    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecfs-0.3.0 test/test_proceeding.rb