Sha256: c0f0c0778620ced0660f6b55eaf7401c7be01d06bab03ca5b9244c94ebd7544a
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true RSpec.describe HTTP::Options, "features" do let(:opts) { HTTP::Options.new } it "defaults to be empty" do expect(opts.features).to be_empty end it "accepts plain symbols in array" do opts2 = opts.with_features([:auto_inflate]) expect(opts.features).to be_empty expect(opts2.features.keys).to eq([:auto_inflate]) expect(opts2.features[:auto_inflate]). to be_instance_of(HTTP::Features::AutoInflate) end it "accepts feature name with its options in array" do opts2 = opts.with_features([{:auto_deflate => {:method => :deflate}}]) expect(opts.features).to be_empty expect(opts2.features.keys).to eq([:auto_deflate]) expect(opts2.features[:auto_deflate]). to be_instance_of(HTTP::Features::AutoDeflate) expect(opts2.features[:auto_deflate].method).to eq("deflate") end it "raises error for not supported features" do expect { opts.with_features([:wrong_feature]) }. to raise_error(HTTP::Error) { |error| expect(error.message).to eq("Unsupported feature: wrong_feature") } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
http-2.2.2 | spec/lib/http/options/features_spec.rb |
http-2.2.1 | spec/lib/http/options/features_spec.rb |
http-2.2.0 | spec/lib/http/options/features_spec.rb |