summaryrefslogtreecommitdiff
path: root/spec/models/license_status_spec.rb
blob: 09e2319ec90ad7a475d63c6a2b4c6a93097659ac (plain)
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
require "spec_helper"

describe LicenseStatus do
  describe ".find_match" do
    it "returns the active status" do
      LicenseStatus.find_match("active").should == LicenseStatus::ACTIVE
      LicenseStatus.find_match("ACTIVE").should == LicenseStatus::ACTIVE
      LicenseStatus.find_match("Active").should == LicenseStatus::ACTIVE
    end

    it "returns the expired status" do
      LicenseStatus.find_match("expired").should == LicenseStatus::EXPIRED
      LicenseStatus.find_match("EXPIRED").should == LicenseStatus::EXPIRED
      LicenseStatus.find_match("Expired").should == LicenseStatus::EXPIRED
    end

    it "returns the confidential status" do
      LicenseStatus.find_match("confidential").should == LicenseStatus::CONFIDENTIAL
      LicenseStatus.find_match("CONFIDENTIAL").should == LicenseStatus::CONFIDENTIAL
      LicenseStatus.find_match("Confidential").should == LicenseStatus::CONFIDENTIAL
    end

    it "returns the active status as the default" do
      [nil, "", "oh hai"].each do |key|
        LicenseStatus.find_match(key).should == LicenseStatus::ACTIVE
      end
    end
  end
end