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.24.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.23.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.22.1 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.22.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.21.1 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.21.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.20.3 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.20.2 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.20.1 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.20.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.19.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.18.3 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.18.2 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.18.1 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.18.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.17.2 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.17.1 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.17.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.16.0 spec/gotransverse-tract-api/api_data_spec.rb
gotransverse-tract-api-0.15.0 spec/gotransverse-tract-api/api_data_spec.rb