File: x_download_options_spec.rb

package info (click to toggle)
ruby-secure-headers 7.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 508 kB
  • sloc: ruby: 3,353; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 861 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
# frozen_string_literal: true
require "spec_helper"

module SecureHeaders
  describe XDownloadOptions do
    specify { expect(XDownloadOptions.make_header).to eq([XDownloadOptions::HEADER_NAME, XDownloadOptions::DEFAULT_VALUE]) }
    specify { expect(XDownloadOptions.make_header("noopen")).to eq([XDownloadOptions::HEADER_NAME, "noopen"]) }

    context "invalid configuration values" do
      it "accepts noopen" do
        expect do
          XDownloadOptions.validate_config!("noopen")
        end.not_to raise_error
      end

      it "accepts nil" do
        expect do
          XDownloadOptions.validate_config!(nil)
        end.not_to raise_error
      end

      it "doesn't accept anything besides noopen" do
        expect do
          XDownloadOptions.validate_config!("open")
        end.to raise_error(XDOConfigError)
      end
    end
  end
end