File: mixin_spec.rb

package info (click to toggle)
ruby-http 4.4.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 704 kB
  • sloc: ruby: 5,388; makefile: 9
file content (36 lines) | stat: -rw-r--r-- 757 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

RSpec.describe HTTP::Headers::Mixin do
  let :dummy_class do
    Class.new do
      include HTTP::Headers::Mixin

      def initialize(headers)
        @headers = headers
      end
    end
  end

  let(:headers) { HTTP::Headers.new }
  let(:dummy)   { dummy_class.new headers }

  describe "#headers" do
    it "returns @headers instance variable" do
      expect(dummy.headers).to be headers
    end
  end

  describe "#[]" do
    it "proxies to headers#[]" do
      expect(headers).to receive(:[]).with(:accept)
      dummy[:accept]
    end
  end

  describe "#[]=" do
    it "proxies to headers#[]" do
      expect(headers).to receive(:[]=).with(:accept, "text/plain")
      dummy[:accept] = "text/plain"
    end
  end
end