File: error_spec.rb

package info (click to toggle)
ruby-bcrypt 3.1.20-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 340 kB
  • sloc: ansic: 1,390; java: 764; ruby: 438; asm: 157; makefile: 12
file content (37 lines) | stat: -rw-r--r-- 924 bytes parent folder | download | duplicates (5)
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
37
require File.expand_path(File.join(File.dirname(__FILE__), "..", "spec_helper"))

describe "Errors" do

  shared_examples "descends from StandardError" do
    it "can be rescued as a StandardError" do
      expect(described_class).to be < StandardError
    end
  end

  shared_examples "descends from BCrypt::Error" do
    it "can be rescued as a BCrypt::Error" do
      expect(described_class).to be < BCrypt::Error
    end
  end

  describe BCrypt::Error do
    include_examples "descends from StandardError"
  end

  describe BCrypt::Errors::InvalidCost do
    include_examples "descends from BCrypt::Error"
  end

  describe BCrypt::Errors::InvalidHash do
    include_examples "descends from BCrypt::Error"
  end

  describe BCrypt::Errors::InvalidSalt do
    include_examples "descends from BCrypt::Error"
  end

  describe BCrypt::Errors::InvalidSecret do
    include_examples "descends from BCrypt::Error"
  end

end