summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/license_status/confidential.rb6
-rw-r--r--spec/models/license_status/confidential_spec.rb17
2 files changed, 22 insertions, 1 deletions
diff --git a/app/models/license_status/confidential.rb b/app/models/license_status/confidential.rb
index 81178f6..d108491 100644
--- a/app/models/license_status/confidential.rb
+++ b/app/models/license_status/confidential.rb
@@ -4,6 +4,10 @@ class LicenseStatus::Confidential
end
def matches?(name)
- "confidential" == name
+ to_s == name
+ end
+
+ def to_s
+ 'confidential'
end
end
diff --git a/spec/models/license_status/confidential_spec.rb b/spec/models/license_status/confidential_spec.rb
new file mode 100644
index 0000000..2b13449
--- /dev/null
+++ b/spec/models/license_status/confidential_spec.rb
@@ -0,0 +1,17 @@
+require "spec_helper"
+
+describe LicenseStatus::Confidential do
+ let!(:public_license) { License.create(confidential: false) }
+ let!(:confidential_license) { License.create(confidential: true) }
+ subject { LicenseStatus::Confidential.new }
+
+ it "returns confidential results" do
+ results = subject.filter(License)
+ results.should include(confidential_license)
+ results.should_not include(public_license)
+ end
+
+ it "returns it's name" do
+ subject.to_s.should == 'confidential'
+ end
+end