Sha256: 2486a0c107c2d9b18c9a717bcbad2f16c98f87516deb86604e471914ca4b4c2a

Contents?: true

Size: 641 Bytes

Versions: 4

Compression:

Stored size: 641 Bytes

Contents

require 'spec_helper'

describe Bitcoin::Request do
  it "should omit null arguments and everything after them" do
    # bitcoin rejects null values even for optional params. Since
    # even params following those may have default non-nil values,
    # we'll assume the first non-nil value marks a set of optional
    # params, and drop it and everything following it.

    req = Bitcoin::Request.new('svc', [1, nil, nil, nil])
    req.params.should == [1]
    
    req = Bitcoin::Request.new('svc', [nil])
    req.params.should == []
    
    req = Bitcoin::Request.new('svc', [1, nil, nil, 1, nil])
    req.params.should == [1]
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
bitcoin-client-0.0.3 spec/lib/bitcoin/request_spec.rb
bitcoin-client-0.0.2 spec/lib/bitcoin/request_spec.rb
ramontayag-bitcoin-client-0.1.0 spec/lib/bitcoin/request_spec.rb
bitcoin-client-0.0.1 spec/lib/bitcoin/request_spec.rb