File: etag.rb

package info (click to toggle)
ruby-protocol-http 0.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 840 kB
  • sloc: ruby: 6,904; makefile: 4
file content (34 lines) | stat: -rw-r--r-- 612 bytes parent folder | download
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
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2023-2025, by Samuel Williams.

require "protocol/http/header/etag"

describe Protocol::HTTP::Header::ETag do
	let(:header) {subject.new(description)}
	
	with 'W/"abcd"' do
		it "is weak" do
			expect(header).to be(:weak?)
		end
	end
	
	with '"abcd"' do
		it "is not weak" do
			expect(header).not.to be(:weak?)
		end
	end
	
	with "#<<" do
		let(:header) {subject.new}
		
		it "can replace values" do
			header << '"abcd"'
			expect(header).not.to be(:weak?)
			
			header << 'W/"abcd"'
			expect(header).to be(:weak?)
		end
	end
end