Skip to content

Commit

Permalink
The switch to URI.escape changes what is escaped
Browse files Browse the repository at this point in the history
```ruby
[1] pry(main)> URI.escape('home:henne')
=> "home:henne"
[2] pry(main)> CGI.escape('home:henne')
=> "home%3Ahenne"
```
  • Loading branch information
hennevogel committed Mar 14, 2022
1 parent 6fe8ef4 commit e3d5bca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/api/spec/models/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,17 @@
end

describe '#source_path' do
it { expect(package_with_file.source_path).to eq('/source/home:tom/package_with_files') }
it { expect(package_with_file.source_path('icon')).to eq('/source/home:tom/package_with_files/icon') }
it { expect(package_with_file.source_path('icon', format: :html)).to eq('/source/home:tom/package_with_files/icon?format=html') }
it { expect(package_with_file.source_path).to eq('/source/home%3Atom/package_with_files') }
it { expect(package_with_file.source_path('icon')).to eq('/source/home%3Atom/package_with_files/icon') }
it { expect(package_with_file.source_path('icon', format: :html)).to eq('/source/home%3Atom/package_with_files/icon?format=html') }
end

describe '#public_source_path' do
it { expect(package_with_file.public_source_path).to eq('/public/source/home:tom/package_with_files') }
it { expect(package_with_file.public_source_path('icon')).to eq('/public/source/home:tom/package_with_files/icon') }
it { expect(package_with_file.public_source_path).to eq('/public/source/home%3Atom/package_with_files') }
it { expect(package_with_file.public_source_path('icon')).to eq('/public/source/home%3Atom/package_with_files/icon') }

it 'adds the format parameter to the url that was given to the method' do
expect(package_with_file.public_source_path('icon', format: :html)).to eq('/public/source/home:tom/package_with_files/icon?format=html')
expect(package_with_file.public_source_path('icon', format: :html)).to eq('/public/source/home%3Atom/package_with_files/icon?format=html')
end
end

Expand Down

0 comments on commit e3d5bca

Please sign in to comment.