Sha256: 77f38f2c05dcaf4fba0cad6262c7d759b62072e0e82b6c637fac3c35dc032fb1

Contents?: true

Size: 1.09 KB

Versions: 22

Compression:

Stored size: 1.09 KB

Contents

require 'spec_helper'

class FooLicense < LicenseFinder::License::Base
  self.alternative_names = ["the foo license"]
  self.license_url = "http://foo.license.com"

  def self.pretty_name
    "Ye Ole Foo License"
  end
end

module LicenseFinder
  describe License do
    describe ".find_by_name" do
      it "should match on demodulized names" do
        License.find_by_name("FooLicense").should == FooLicense
      end

      it "should match on pretty names" do
        License.find_by_name("Ye Ole Foo License").should == FooLicense
      end

      it "should match on alternative names" do
        License.find_by_name("the foo license").should == FooLicense
      end

      it "should return nil if no match" do
        License.find_by_name(:unknown).should be_nil
      end
    end
  end
end

describe LicenseFinder::License::Base do
  describe ".names" do
    subject do
      Class.new(LicenseFinder::License::Base) do
        def self.demodulized_name; "FooLicense"; end
        self.alternative_names = ["foo license"]
      end.names
    end

    it { should =~ ["FooLicense", "foo license"] }
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
license_finder-0.7.3 spec/lib/license_finder/license_spec.rb
license_finder-0.7.1 spec/lib/license_finder/license_spec.rb