spec/licensee/license_spec.rb in licensee-9.14.0 vs spec/licensee/license_spec.rb in licensee-9.14.1

- old
+ new

@@ -343,11 +343,11 @@ end context 'muscache' do let(:license) do license = described_class.new 'MIT' - content = license.content + '[foo] [bar]' + content = "#{license.content}[foo] [bar]" license.instance_variable_set(:@content, content) license end it 'returns mustache content' do @@ -363,13 +363,14 @@ end end end context 'License.title_regex' do + namey = %i[title nickname key] described_class.all(hidden: true, pseudo: false).each do |license| context "the #{license.title} license" do - %i[title nickname key].each do |variation| + namey.each do |variation| next if license.send(variation).nil? context "the license #{variation}" do let(:license_variation) { license.send(variation).sub('*', 'u') } let(:text) { license_variation } @@ -473,24 +474,27 @@ expect(hash).to eql(expected) end end context 'source regex' do + schemes = %w[http https] + prefixes = ['www.', ''] + suffixes = ['.html', '.htm', '.txt', ''] described_class.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| + schemes.each do |scheme| context "with a #{scheme}:// scheme" do before { source.scheme = scheme } - ['www.', ''].each do |prefix| + prefixes.each do |prefix| context "with '#{prefix}' before the host" do before do source.host = "#{prefix}#{source.host.sub(/\Awww\./, '')}" end - ['.html', '.htm', '.txt', ''].each do |suffix| + suffixes.each do |suffix| context "with '#{suffix}' after the path" do before do next if license.key == 'wtfpl' regex = /#{Licensee::License::SOURCE_SUFFIX}\z/