Sha256: 5201170fdbda6510f096ef75e8f6098039e45aa3e9f7946200e94ae1cd73d199

Contents?: true

Size: 487 Bytes

Versions: 28

Compression:

Stored size: 487 Bytes

Contents

require 'spec_helper'

module GoTransverseTractApi

  RSpec.describe ApiData do
    before(:each) { http_auth }

    describe ".compact" do
      it "returns a hash by eliminating all nil" do
        given_hash = {a: {}, c: 'p', s: nil, d: {e: nil, m: nil}, f: {g: {}, x: {n: 'h', i: nil, j: 'l'}}}
        expected_hash = {:a=>{}, :c=>"p", :f=>{:g=>{}, :x=>{:n=>"h", :j=>"l"}}}

        expect(described_class.new.compact(given_hash)).to eq(expected_hash)
      end
    end

  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gotransverse-tract-api-0.14.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.13.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.12.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.11.2 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.11.1 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.11.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.10.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.9.2 spec/gotransverse-tract-api/api_data_spec.rb