spec/licensee/license_spec.rb in licensee-9.10.0 vs spec/licensee/license_spec.rb in licensee-9.10.1
- old
+ new
@@ -42,10 +42,11 @@
end
it 'includes featured licenses' do
expect(licenses).to include(mit)
expect(licenses).to_not include(cc_by)
+ expect(licenses).to_not include(other)
end
end
context 'hidden licenses' do
let(:arguments) { { hidden: true } }
@@ -61,20 +62,22 @@
let(:arguments) { { featured: true } }
it 'includes only featured licenses' do
expect(licenses).to include(mit)
expect(licenses).to_not include(cc_by)
+ expect(licenses).to_not include(other)
expect(licenses.count).to eql(featured_license_count)
end
end
context 'non-featured licenses' do
let(:arguments) { { featured: false } }
it 'includes only non-featured licenses' do
expect(licenses).to include(unlicense)
expect(licenses).to_not include(mit)
+ expect(licenses).to_not include(other)
expect(licenses.count).to eql(non_featured_license_count)
end
context 'including hidden licenses' do
let(:arguments) { { featured: false, hidden: true } }
@@ -86,44 +89,62 @@
expect(licenses.count).to eql(license_count - featured_license_count)
end
end
end
- context 'psudo licenses' do
+ context 'pseudo licenses' do
let(:other) { Licensee::License.find('other') }
context 'by default' do
let(:arguments) { {} }
- it "doesn't include psudo licenses" do
+ it "doesn't include pseudo licenses" do
expect(licenses).to_not include(other)
end
end
context 'with hidden licenses' do
let(:arguments) { { hidden: true } }
- it 'includes psudo licenses' do
+ it 'includes pseudo licenses' do
expect(licenses).to include(other)
end
end
context 'when explicitly asked' do
- let(:arguments) { { hidden: true, psuedo: true } }
+ let(:arguments) { { hidden: true, pseudo: true } }
it 'includes psudo licenses' do
expect(licenses).to include(other)
end
end
context 'when explicitly excluded' do
- let(:arguments) { { hidden: true, psuedo: false } }
+ let(:arguments) { { hidden: true, pseudo: false } }
it "doesn'tincludes psudo licenses" do
expect(licenses).to_not include(other)
end
end
+
+ context 'mispelled' do
+ context 'when explicitly asked' do
+ let(:arguments) { { hidden: true, psuedo: true } }
+
+ it 'includes psudo licenses' do
+ expect(licenses).to include(other)
+ end
+ end
+
+ context 'when explicitly excluded' do
+ let(:arguments) { { hidden: true, psuedo: false } }
+
+ it "doesn'tincludes psudo licenses" do
+ expect(licenses).to_not include(other)
+ end
+ end
+ end
end
end
context 'finding' do
it 'finds the MIT license' do
@@ -199,11 +220,12 @@
it 'returns the name' do
expect(mit.name).to eql('MIT License')
end
it 'uses the default name when none exists' do
- expect(other.name).to eql('NOASSERTION')
+ expect(other.name).to eql('Other')
+ expect(no_license.name).to eql('No license')
end
it 'expoeses the nickname' do
expect(gpl.nickname).to eql('GNU GPLv3')
end
@@ -339,11 +361,11 @@
end
end
end
context 'License.title_regex' do
- Licensee::License.all(hidden: true, psuedo: false).each do |license|
+ Licensee::License.all(hidden: true, pseudo: false).each do |license|
context "the #{license.title} license" do
%i[title nickname key].each do |variation|
next if license.send(variation).nil?
context "the license #{variation}" do
@@ -449,11 +471,11 @@
expect(hash).to eql(expected)
end
end
context 'source regex' do
- Licensee::License.all(hidden: true, psuedo: false).each do |license|
+ Licensee::License.all(hidden: true, pseudo: false).each do |license|
context "the #{license.title} license" do
let(:source) { URI.parse(license.source) }
%w[http https].each do |scheme|
context "with a #{scheme}:// scheme" do
@@ -467,9 +489,10 @@
['.html', '.htm', '.txt', ''].each do |suffix|
context "with '#{suffix}' after the path" do
before do
next if license.key == 'wtfpl'
+
regex = /#{Licensee::License::SOURCE_SUFFIX}\z/
source.path = source.path.sub(regex, '')
source.path = "#{source.path}#{suffix}"
end