Sha256: 43d7a65de658f2aad78d79f331b7204db3726ceea9e616cdc3edce43682e8549

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

require "spec_helper"

describe Apipie::FileHandler do

  describe "match?" do
    let(:file_handler) { Apipie::FileHandler.new File.dirname(__FILE__) }

    it { expect(file_handler.match? 'file_handler_spec.rb').to be_truthy }
    it { expect(file_handler.match? 'foo.bar').to be_falsy }

    context 'path contains null bytes' do
      let(:path) { "foo%00.bar" }

      it { expect(file_handler.match? path).to be_falsy }
      it { expect { file_handler.match? path }.to_not raise_error }
    end

    context 'when the path contains an invalid byte sequence in UTF-8' do
      let(:path) { "%B6" }

      it { expect(file_handler.match? path).to be_falsy }
      it { expect { file_handler.match? path }.to_not raise_error }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apipie-rails-1.4.2 spec/lib/apipie/file_handler_spec.rb
apipie-rails-1.4.1 spec/lib/apipie/file_handler_spec.rb
apipie-rails-1.4.0 spec/lib/apipie/file_handler_spec.rb