Sha256: 182b573c7014b7db3da996d14621b07ce71735bdaba51806f97673e7b5b73a60

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Acfs::Location do
  let(:location) { described_class.new(uri, args) }
  let(:uri)      { 'http://localhost/users/:id' }
  let(:args)     { {'id' => 4} }

  describe '#str' do
    subject(:str) { location.str }

    it 'replaces variables with values' do
      expect(str).to eq 'http://localhost/users/4'
    end

    context 'with special characters' do
      let(:args) { {'id' => '4 [@(\/!^$'} }

      it 'escapes special characters' do
        expect(str).to eq 'http://localhost/users/4+%5B%40%28%5C%2F%21%5E%24'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acfs-2.0.0 spec/acfs/location_spec.rb