Sha256: 2b6fd6bacb1d252d5e24d1994e3fb2e9cb557df4309128c9e13da03d686ea339

Contents?: true

Size: 715 Bytes

Versions: 12

Compression:

Stored size: 715 Bytes

Contents

require_relative "spec_helper"

module Nyara
  describe Ext, '.mime_match' do
    it "#mime_match_seg" do
      a = Ext.mime_match_seg 'text', 'text', 'html'
      assert_equal true, a

      a = Ext.mime_match_seg 'text/html', 'text', 'stylesheet'
      assert_equal false, a

      a = Ext.mime_match_seg '*', 'text', 'html'
      assert_equal true, a
    end

    it "#mime_match works with wildcards" do
      a = Ext.mime_match %w'*', [%w'text html html']
      assert_equal 'html', a

      a = Ext.mime_match %w'application/javascript text/*', [%w'some text txt', %w'text html html']
      assert_equal 'html', a

      a = Ext.mime_match %w'text/*', [%w'some text txt']
      assert_nil a
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 spec/ext_mime_match_spec.rb
nyara-0.1.pre.1 spec/ext_mime_match_spec.rb
nyara-0.1.pre.0 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.9 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.8 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.6 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.5 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.4 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.3 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.2 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre.1 spec/ext_mime_match_spec.rb
nyara-0.0.1.pre spec/ext_mime_match_spec.rb