Sha256: 6ca645a1f78071cd2aeb59eb49b2e3eb96e98387ea243f08cc8100c7a8422b7a

Contents?: true

Size: 604 Bytes

Versions: 4

Compression:

Stored size: 604 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

4 entries across 4 versions & 1 rubygems

Version Path
acfs-1.5.1 spec/acfs/location_spec.rb
acfs-1.5.0 spec/acfs/location_spec.rb
acfs-1.4.0 spec/acfs/location_spec.rb
acfs-1.3.4 spec/acfs/location_spec.rb