Sha256: 45e3acffed349302e50756aab13ea4dd3359a553e93437addccfbce251764f0d

Contents?: true

Size: 1.04 KB

Versions: 49

Compression:

Stored size: 1.04 KB

Contents

describe :net_httpheader_each_name, :shared => true do
  before(:each) do
    @headers = NetHTTPHeaderSpecs::Example.new
    @headers["My-Header"] = "test"
    @headers.add_field("My-Other-Header", "a")
    @headers.add_field("My-Other-Header", "b")
  end

  describe "when passed a block" do
    it "yields each header key to the passed block (keys in lower case)" do
      res = []
      @headers.send(@method) do |key|
        res << key
      end
      res.should == ["my-header", "my-other-header"]
    end
  end

  describe "when passed no block" do
    ruby_version_is "" ... "1.8.7" do
      it "raises a LocalJumpError" do
        lambda { @headers.send(@method) }.should raise_error(LocalJumpError)
      end
    end

    ruby_version_is "1.8.7" do
      it "returns an Enumerator" do
        enumerator = @headers.send(@method)
        enumerator.should be_an_instance_of(enumerator_class)

        res = []
        enumerator.each do |key|
          res << key
        end
        res.should == ["my-header", "my-other-header"]
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-7.5.1 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-7.4.1 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-7.1.17 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-6.2.0 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-6.0.11 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.18 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.17 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.15 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.2 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-5.5.0 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-3.3.5 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb
rhodes-3.4.2 spec/framework_spec/app/spec/library/net/http/httpheader/shared/each_name.rb