From ea2de48ec543fb341be31e9ed312b72ede860aee Mon Sep 17 00:00:00 2001 From: mo khan Date: Fri, 21 Feb 2014 20:51:30 -0700 Subject: inplement query method to find matching status strategy. --- spec/models/license_status_spec.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 spec/models/license_status_spec.rb (limited to 'spec/models') diff --git a/spec/models/license_status_spec.rb b/spec/models/license_status_spec.rb new file mode 100644 index 0000000..09e2319 --- /dev/null +++ b/spec/models/license_status_spec.rb @@ -0,0 +1,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 -- cgit v1.2.3